Answers for "electron refresh page"

2

electron reload html

const {getCurrentWindow, globalShortcut} = require('electron').remote;

var reload = ()=>{
  getCurrentWindow().reload()
}

globalShortcut.register('F5', reload);
globalShortcut.register('CommandOrControl+R', reload);
// here is the fix bug #3778, if you know alternative ways, please write them
window.addEventListener('beforeunload', ()=>{
  globalShortcut.unregister('F5', reload);
  globalShortcut.unregister('CommandOrControl+R', reload);
})
Posted by: Guest on May-11-2020
1

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()
	})
});
Posted by: Guest on April-15-2020

Browse Popular Code Answers by Language