Electron App -- Electron reload not working

2.2k views Asked by At

I apologize if this is too trivial of a question, but I am new to electron and am having trouble getting electron-reload or win.reload to work on my window's Browserview. They perfectly work on the main body of the browser window, but the browser view that sits off to the left is not reloaded, even though it too is webContent in theory.

Code for electron-reload (In Index.js)

require('electron-reload')(__dirname)

Code for manual Ctrl-r reload (also in Index.js

   const globalShortcut = electron.globalShortcut;

    globalShortcut.register('CommandOrControl+R', function() {
        console.log('CommandOrControl+R is pressed' + __dirname);
        mainWindow.reload()
    })

Thank you!

1

There are 1 answers

0
melekkrsn On

if you create browserview like this

view = new BrowserView()
mainWindow.setBrowserView(view)
view.setBounds({ x:120 , y: 120, width: 300, height: 300 })
view.webContents.loadURL('.....')

maybe you can try to add this line below the 'mainWindow.reload()'

view.webContents.reload()