mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-25 17:25:16 +03:00
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.)
This commit is contained in:
parent
bd1545484d
commit
4b7af1c951
1 changed files with 16 additions and 0 deletions
16
main.js
16
main.js
|
@ -1,5 +1,21 @@
|
||||||
'use strict';
|
'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 () {
|
$(document).ready(function () {
|
||||||
// translate to user-selected language
|
// translate to user-selected language
|
||||||
localize();
|
localize();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue