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);