Open new windows in external browser
When a user clicks a link, this opens the link in a new external browser and not in a new nw window (without toolbar, download manager, etc.)10.3.x-maintenance
parent
bd1545484d
commit
4b7af1c951
16
main.js
16
main.js
|
@ -1,5 +1,21 @@
|
|||
'use strict';
|
||||
|
||||
// Open new windows in external browser
|
||||
try {
|
||||
var gui = require('nw.gui');
|
||||
|
||||
//Get the current window
|
||||
var win = gui.Window.get();
|
||||
|
||||
//Listen to the new window event
|
||||
win.on('new-win-policy', function (frame, url, policy) {
|
||||
gui.Shell.openExternal(url);
|
||||
policy.ignore();
|
||||
});
|
||||
} catch (ex) {
|
||||
console.log("require does not exist, maybe inside chrome");
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
|
|
Loading…
Reference in New Issue