Browse Source

Fixes #2

pull/3/head
Ramiro Saenz 9 years ago
parent
commit
ac31ad01f9
  1. 7
      app/ux/WebView.js
  2. 4
      electron/main.js

7
app/ux/WebView.js

@ -84,13 +84,18 @@ Ext.define('Rambox.ux.WebView',{
if ( !webview.isAudioMuted() && me.muted ) webview.setAudioMuted(me.muted);
// Open links in default browser
webview.addEventListener('new-window', (e) => {
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);

4
electron/main.js

@ -117,6 +117,10 @@ function createWindow () {
mainWindow.on('page-title-updated', (e, title) => updateBadge(title));
mainWindow.webContents.on('will-navigate', function(event, url) {
event.preventDefault();
});
// Emitted when the window is closed.
mainWindow.on('close', function(e) {
if ( !isQuitting ) {

Loading…
Cancel
Save