How can I access the DOM of a in Electron?

后端 未结 3 1269
盖世英雄少女心
盖世英雄少女心 2020-12-30 10:40

I\'m just getting started with Electron, with prior experience with node-webkit (nw.js).

In nw.js, I was able to create iframes and then access the DOM of said ifram

3条回答
  •  暖寄归人
    2020-12-30 11:05

    This relates to previous answer (I am not allowed to comment): Important info regarding ipc module for users of Electron 1.x:

    The ipc module was split into two separate modules:

    • ipcMain for the main process
    • ipcRenderer for the renderer process

    So, the above examples need to be corrected, instead of

    // Outdated - doesn't work in 1.x    
    var ipc = require("ipc");
    

    use:

    // In main process.
    var ipcMain = require('electron').ipcMain
    

    And:

    // In renderer process.
    var ipcRenderer = require('electron').ipcRenderer
    

    See: http://electron.atom.io/blog/2015/11/17/electron-api-changes section on 'Splitting the ipc module'

提交回复
热议问题