Open links in the default browser
This commit is contained in:
parent
72c3dc286c
commit
590284e4cb
1 changed files with 9 additions and 0 deletions
9
main.js
9
main.js
|
@ -8,6 +8,7 @@ const autoUpdater = require('electron-updater').autoUpdater
|
||||||
const autoUpdaterInterval = 60 * 60 * 1000;
|
const autoUpdaterInterval = 60 * 60 * 1000;
|
||||||
const ipc = electron.ipcMain;
|
const ipc = electron.ipcMain;
|
||||||
const Menu = electron.Menu;
|
const Menu = electron.Menu;
|
||||||
|
const shell = electron.shell;
|
||||||
|
|
||||||
app.setAppUserModelId('org.whispersystems.signal-desktop')
|
app.setAppUserModelId('org.whispersystems.signal-desktop')
|
||||||
|
|
||||||
|
@ -77,6 +78,14 @@ function createWindow () {
|
||||||
mainWindow.webContents.openDevTools()
|
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.
|
// Emitted when the window is closed.
|
||||||
mainWindow.on('closed', function () {
|
mainWindow.on('closed', function () {
|
||||||
// Dereference the window object, usually you would store windows
|
// Dereference the window object, usually you would store windows
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue