Last active
December 25, 2017 22:30
-
-
Save vojtatranta/e62e13e3974ad7251b394aa7769caff4 to your computer and use it in GitHub Desktop.
open url in browser from electron
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const electron = require('electron') | |
const BrowserWindow = electron.BrowserWindow | |
const shell = electron.shell | |
const window = new BrowserWindoe({...}) | |
function handleRedirect(e, url) { | |
e.preventDefault() | |
if (url !== mainWindow.webContents.getURL()) { | |
shell.openExternal(url) | |
} | |
} | |
window.webContents.on('will-navigate', handleRedirect) | |
window.webContents.on('new-window', handleRedirect) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://s10.postimg.org/tq35furg9/screenshot_102.png
jaksi nefunguje,.. + sa mi nezdá to Windoe má asi (teda určite) byť Window