Implemented opening of links in new window

This commit is contained in:
Jia Hao 2015-07-05 20:44:45 +08:00
parent 4b34cf1ffb
commit 46bb14ac2a
2 changed files with 8 additions and 1 deletions

View File

@ -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();
});
});

View File

@ -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) {