Browse Source

Open Rambox links in external browser.

Links inside Rambox, and not inside Webviews. Like GitHub, Donate, etc.
pull/92/merge
Ramiro Saenz 9 years ago
parent
commit
3c20f55e85
  1. 11
      electron/main.js

11
electron/main.js

@ -134,8 +134,17 @@ function createWindow () {
mainWindow.on('page-title-updated', (e, title) => updateBadge(title)); mainWindow.on('page-title-updated', (e, title) => updateBadge(title));
// Open links in default browser
mainWindow.webContents.on('new-window', function(e, url, frameName, disposition, options) {
const protocol = require('url').parse(url).protocol;
if (protocol === 'http:' || protocol === 'https:' || protocol === 'mailto:') {
e.preventDefault();
shell.openExternal(url);
}
});
mainWindow.webContents.on('will-navigate', function(event, url) { mainWindow.webContents.on('will-navigate', function(event, url) {
//event.preventDefault(); event.preventDefault();
}); });
// Emitted when the window is closed. // Emitted when the window is closed.

Loading…
Cancel
Save