♻️ Electron new-window 事件替换

This commit is contained in:
Liang Ding 2022-11-25 10:00:22 +08:00
parent 18dd5b57ed
commit 223677e462
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -783,6 +783,11 @@ app.on('web-contents-created', (webContentsCreatedEvent, contents) => {
newWindowEvent.preventDefault()
shell.openExternal(url)
})
contents.setWindowOpenHandler((details) => {
shell.openExternal(details.url)
return {action: 'deny',}
})
})
app.on('before-quit', (event) => {