How to call a JavaScript function on a web page rendered by Electron?

前端 未结 3 1721
滥情空心
滥情空心 2020-12-28 16:45

I\'m trying to write a wrapper for Twitter using Electron (formerly Atom Shell).

My main.js file (it looks almost identical to the \"Hello World\" examp

3条回答
  •  独厮守ぢ
    2020-12-28 17:20

    I have solved the problem. Here's the example code:

    ...
    
    app.on('ready', function() {
    
      ...
    
      mainWindow.webContents.on('did-finish-load', function() {
        mainWindow.webContents.executeJavaScript("alert('Hello There!');");
      });
    
      ...
    
    });
    

提交回复
热议问题