How do I to disable the f12 option to view the code?Confused

Get help using Construct 2

Post » Wed Mar 23, 2016 12:15 pm

Hi people,
I exported a Construct2 game with nw.js and when I run everything perfect ... but ...
when I press the F12 key I see the html code ...
I do not like a player accidentally press the f12 key and did not know what to do ...
I'm a little confuse ... :?
Is it possible to disable the f12 option to view the code before compiled .exe???

Thanks
B
11
S
1
Posts: 49
Reputation: 848

Post » Wed Mar 23, 2016 5:02 pm

on web,I found this Disable F12 Key in a Page
so you can test for nw.js..add Browser object and event
System -On Start of Layout.....Browser Execute Javascript

Code: Select all
"document.onkeypress = function (event) { 
event = (event || window.event); 
if (event.keyCode == 123) { 
return false;  }                                                           } 


document.onkeydown = function (event) { 
event = (event || window.event); 
if (event.keyCode == 123) { 
return false;  } 
                                                                                       }  "
B
66
S
24
G
7
Posts: 1,514
Reputation: 11,039

Post » Thu Mar 24, 2016 8:05 am

Thanks Korbaach for your time!
B
11
S
1
Posts: 49
Reputation: 848

Post » Thu Mar 24, 2016 10:43 am

Edited.... i was thinking your asking for the f12 option for canceling the developer console on browsers... now i seen the actual request ... my bad
Last edited by gamecorpstudio on Thu Mar 24, 2016 2:00 pm, edited 2 times in total.
B
77
S
23
G
69
Posts: 1,353
Reputation: 43,958

Post » Thu Mar 24, 2016 10:55 am

Just download the 'normal' version of nw.js and replace the files in the nwforc2 folder. C2 ships with the sdk version of nw.js so that you can use the debug functions, but the normal version does not contain the debug functions. Here's the link.
A big fan of JavaScript.
B
74
S
20
G
71
Posts: 2,228
Reputation: 44,888

Post » Fri Mar 25, 2016 11:37 am

Ok! I I did not know this option. Thank you so much!
B
11
S
1
Posts: 49
Reputation: 848


Return to How do I....?

Who is online

Users browsing this forum: dop2000, KTML5 and 25 guests