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
80
S
46
G
24
Posts: 525
Reputation: 20,955

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
92
S
32
G
109
Posts: 5,291
Reputation: 70,993

Post » Tue Jun 14, 2016 6:58 am

Image Image
B
25
S
14
G
136
Posts: 876
Reputation: 71,005

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
80
S
46
G
24
Posts: 525
Reputation: 20,955


Return to How do I....?

Who is online

Users browsing this forum: CrudeMik and 33 guests