How do I Prevent Devtools in nw.js?

Get help using Construct 2

Post » Tue Jun 14, 2016 1:29 am

Is there a way to prevent the devtools from showing in an nw.js build?
B
89
S
47
G
25
Posts: 535
Reputation: 21,827

Post » Tue Jun 14, 2016 4:22 am

Supposedly there's a way to build without it. It's called normal and with it it's called sdk. However that seems to be too much trouble. There was also a way to have a trigger when the devtools were opened so it could then be closed immediately, unfortunately this was depreciated in newer nw.js versions.

The best we can do is disable the shortcut keys to open the devtools. Use the browser object to run this js at the start of the layout.
"document.onkeydown=function(e){var evtobj = window.event? event : e;if (evtobj.keyCode==123 || (evtobj.metaKey && evtobj.altKey && evtobj.keyCode==73))return false;};"

I got it from this link, and it's supposed to work on windows, linux and mac.
http://stackoverflow.com/questions/3365 ... on-nwjs-13
B
94
S
33
G
118
Posts: 5,395
Reputation: 75,851

Post » Tue Jun 14, 2016 6:58 am

Image Image
B
26
S
15
G
143
Posts: 882
Reputation: 74,562

Post » Tue Jun 14, 2016 5:44 pm

@R0J0hound
Yeah, I'd seen doing a normal build was an option, but I'd prefer not to have to deal with another toolchain. Thanks!

@MadSpy
Thanks! That didn't show up on my forum search.
B
89
S
47
G
25
Posts: 535
Reputation: 21,827


Return to How do I....?

Who is online

Users browsing this forum: rot1109 and 24 guests