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:
Иван Музыка 2023-02-13 09:19:45 +03:00 committed by GitHub
parent b2f8887fab
commit 0bb17a61a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
})
}