From d3ccf9dc08661681cb86d5e7ad8f22584d93691f Mon Sep 17 00:00:00 2001 From: Ramiro Saenz Date: Mon, 4 Jul 2016 13:56:09 -0300 Subject: [PATCH] Fixed Open several tabs on click URL - Fixed #28 - Fixed #11 - Fixed #6 - Fixed #18 --- app/ux/WebView.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/app/ux/WebView.js b/app/ux/WebView.js index 4dbd6d77..13d39897 100644 --- a/app/ux/WebView.js +++ b/app/ux/WebView.js @@ -79,23 +79,23 @@ Ext.define('Rambox.ux.WebView',{ } }); + // Open links in default browser + webview.addEventListener('new-window', function(e) { + const protocol = require('url').parse(e.url).protocol; + if (protocol === 'http:' || protocol === 'https:' || protocol === 'mailto:') { + e.preventDefault(); + require('electron').shell.openExternal(e.url); + } + }); + + webview.addEventListener('will-navigate', function(e, url) { + e.preventDefault(); + }); + webview.addEventListener("dom-ready", function(e) { // Mute Webview if ( !webview.isAudioMuted() && me.muted ) webview.setAudioMuted(me.muted); - // Open links in default browser - webview.addEventListener('new-window', function(e) { - const protocol = require('url').parse(e.url).protocol; - if (protocol === 'http:' || protocol === 'https:') { - e.preventDefault(); - require('electron').shell.openExternal(e.url); - } - }); - - webview.addEventListener('will-navigate', function(e, url) { - e.preventDefault(); - }); - // Injected code to detect new messages if ( me.record && me.record.get('js_unread') !== '' ) { console.info('JS Injected', me.src);