简体   繁体   中英

Can I block the console in the browser?

I am making a multiplayer canvas game, It goes really well..
But it seems that if you'll type some commands in the console(like chrome's console) you can cheat the crap out of this game
So is it possible to block the console commands or something?

Any ideas?
Thanks in advance

You should look at separating your game into a client-server model. The inner workings of the game should be hidden from the user on the server side and the client should handle only the user interaction and the visual elements of the game.

If you have already written all your game in Javascript you could look at using NodeJS for the server, this way you can reuse all your existing codebase.

No, it's not.

You can however obfuscate/compress your code before serving it to the clients (UglifyJS or Closure Compiler will do a good job at this), and additionally add some other sanity checks that (try to) make sure no variables have been unexpectedly tampered with through the console/debuggers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM