From 590284e4cbd9c11f1f2776bd8b429c2f2e68b227 Mon Sep 17 00:00:00 2001 From: lilia Date: Wed, 12 Apr 2017 10:56:22 -0700 Subject: [PATCH] Open links in the default browser --- main.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.js b/main.js index 41aaecbef..a90f8e6ca 100644 --- a/main.js +++ b/main.js @@ -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