From 46bb14ac2a7473007776c7f42873bf6c05ff4d12 Mon Sep 17 00:00:00 2001 From: Jia Hao Date: Sun, 5 Jul 2015 20:44:45 +0800 Subject: [PATCH] Implemented opening of links in new window --- app/assets/js/index.js | 7 +++++++ app/main.js | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/assets/js/index.js b/app/assets/js/index.js index e9902b6..b3e7501 100644 --- a/app/assets/js/index.js +++ b/app/assets/js/index.js @@ -18,6 +18,10 @@ ipc.on('params', function(message) { webView.setAttribute('minwidth', '600'); webView.setAttribute('minheight', '800'); + webView.addEventListener('new-window', function(e) { + require('shell').openExternal(e.url); + }); + var webViewDiv = document.getElementById('webViewDiv'); webViewDiv.appendChild(webView); @@ -45,5 +49,8 @@ ipc.on('params', function(message) { var webView = document.getElementById('webView'); webView.undo(); }); + + + }); diff --git a/app/main.js b/app/main.js index aed08e3..3322363 100644 --- a/app/main.js +++ b/app/main.js @@ -31,7 +31,7 @@ app.on('ready', function() { ); mainWindow.loadUrl('file://' + __dirname + '/index.html'); - mainWindow.openDevTools(); + //mainWindow.openDevTools(); mainWindow.webContents.on('did-finish-load', function() { fs.readFile(APP_ARGS_FILE_PATH, 'utf8', function (error, data) { if (error) {