electron: Windows 10 / Event: 'app-command' not fired after `loadURL`
- Electron Version (output of
node_modules/.bin/electron --version
):- 4.0.5
- Operating System (Platform and Version):
- Windows 10 (1803)
- Last known working Electron version (if applicable):
- 3.1.4
Expected Behavior
Event: ‘app-command’ fired when back / forward button is pushed after loadURL
( use five button mouse, cmd -> browser-backward, browser-forward )
https://electronjs.org/docs/api/browser-window#event-app-command-windows
Actual behavior
Event: ‘app-command’ not fired after loadURL
To Reproduce
const electron = require('electron')
const { app, BrowserWindow } = electron
async function createWindow () {
let mainWindow = new BrowserWindow()
mainWindow.on('app-command', function (e, cmd) {
console.log(cmd) // after 5sec, v4 not fired, v3 fired.
})
mainWindow.on('closed', function () {
mainWindow = null
})
console.log('not loaded yet.')
await (ms => new Promise(resolve => setTimeout(resolve, ms)))(5000)
mainWindow.loadURL('https://electronjs.org/')
console.log('loaded!')
}
app.on('ready', createWindow)
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit()
}
})
Screenshots
nothing
Additional Information
nothing
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (8 by maintainers)
Guys just use the following to avoid electron here
VSCode is seeing the same regression. Can this get some attention?
Still a thing in v11.0.3 unfortunately. Here is a dirty JS hack to disable the mouse buttons from navigating (does not work cross browser):
@sandeep1995 btw with my mouse on Windows and Linux the
event.button
is3
and4
, not4
and5
?I can confirm that the event is fired when invoking it on the native title!