electron refresh page code example
Example 1: electron reload html
const {getCurrentWindow, globalShortcut} = require('electron').remote;
var reload = ()=>{
getCurrentWindow().reload()
}
globalShortcut.register('F5', reload);
globalShortcut.register('CommandOrControl+R', reload);
window.addEventListener('beforeunload', ()=>{
globalShortcut.unregister('F5', reload);
globalShortcut.unregister('CommandOrControl+R', reload);
})
Example 2: electron new window
const electron = require('electron')
const BrowserWindow = electron.remote.BrowserWindow
$( "#target" ).click(function() {
let win = new BrowserWindow({ show: false })
win.on('close', function () { win = null })
win.loadURL("github.com")
win.once('ready-to-show', () => {
win.show()
})
});