Open links in the default browser

pull/749/head
lilia 8 years ago committed by Scott Nonnenberg
parent 72c3dc286c
commit 590284e4cb
No known key found for this signature in database
GPG Key ID: A4931C09644C654B

@ -8,6 +8,7 @@ const autoUpdater = require('electron-updater').autoUpdater
const autoUpdaterInterval = 60 * 60 * 1000;
const ipc = electron.ipcMain;
const Menu = electron.Menu;
const shell = electron.shell;
app.setAppUserModelId('org.whispersystems.signal-desktop')
@ -77,6 +78,14 @@ function createWindow () {
mainWindow.webContents.openDevTools()
}
mainWindow.webContents.on('new-window', (e, url) => {
e.preventDefault();
const protocol = require('url').parse(url).protocol
if (protocol === 'http:' || protocol === 'https:') {
shell.openExternal(url)
}
})
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows

Loading…
Cancel
Save