How to can I configure Node Webkit
for open devtools automatically when my application is started?
Can I do it from package.json
configure or javascript
?
How to can I configure Node Webkit
for open devtools automatically when my application is started?
Can I do it from package.json
configure or javascript
?
5 Answers
Reset to default 5You could run some JavaScript on page load which calls showDevTools
on the window.
This works with nw.js v0.11.6.
<head>
<script>
function openDevTools()
{
require('nw.gui').Window.get().showDevTools();
}
</script>
</head>
<body onload="openDevTools()">
Further details in the nw.js documentation here: https://github./nwjs/nw.js/wiki/window#windowshowdevtoolsid--iframe-headless
for nw.js 0.13 and newer you can use:
nw.Window.get().showDevTools();
We can enable the devtools by adding "showDevToolsOnStartup":true under developer section in package.json and can open devtools automatically when application is started.
{
"main": "index.html",
"name": "nw-demo",
"description": "demo app of node-webkit",
"version": "0.1.0",
"keywords": [ "demo", "node-webkit" ],
"window": {
"title": "node-webkit demo",
"icon": "link.png",
"toolbar": true,
"frame": false,
"width": 800,
"height": 500,
"position": "mouse",
"min_width": 400,
"min_height": 200,
"max_width": 800,
"max_height": 600
},
"developer": {
"showDevToolsOnStartup": true
}
}
I have looked around for a solution regarding this myself and couldn't really find a satisfactory answer. You might have to try using f12 in javascript or a keystroke solution.
It's not likely to ever happen or be allowed to happen, quite intentionally, as it's considered a security flaw.
https://code.google./p/chromium/issues/detail?id=112277