mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-18 19:26:35 +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
|
||||
win.webContents.setWindowOpenHandler(({ url }) => {
|
||||
if (url.startsWith('https:')) shell.openExternal(url)
|
||||
return { action: 'deny' }
|
||||
win.webContents.on('will-navigate', (event, url) => {
|
||||
event.preventDefault()
|
||||
shell.openExternal(url)
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user