mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-03-13 20:30:15 +08:00
fix: links open in app, not browser (#343)
* fix: opening links in browser #342 --------- Co-authored-by: 草鞋没号 <308487730@qq.com>
This commit is contained in:
parent
b2f8887fab
commit
0bb17a61a8
@ -68,9 +68,9 @@ async function createWindow() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Make all links open with the browser, not with the application
|
// Make all links open with the browser, not with the application
|
||||||
win.webContents.setWindowOpenHandler(({ url }) => {
|
win.webContents.on('will-navigate', (event, url) => {
|
||||||
if (url.startsWith('https:')) shell.openExternal(url)
|
event.preventDefault()
|
||||||
return { action: 'deny' }
|
shell.openExternal(url)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user