Reputation: 16953
I'm writing an online game that uses a large amount of JavaScript, and cheating would be really easy if you start fiddling with variables in the console or, worse still, checking the elements of the DOM to see where hidden units are, etc.
Right now, I detect when the console is opened and rewrite the entire <body>
element to contain a message explaining that they have to close the console and refresh the page to carry on playing.
Is there a reliable way of closing the console again, or disabling it completely?
Upvotes: 1
Views: 758
Reputation: 1708
A cheater can also write JavaScript into the address bar; for that matter, you could host a browser control within a WinForms program and modify anything on the page without ever opening the console. You could write yourself a nice little cheating app with convenient buttons and a friendly UI and distribute it to all your cheater friends. What you will really have to do is not trust input from the user. Run the important stuff on a server and allow the client only to send AJAX requests. Otherwise cheating is inevitable.
Upvotes: 2