Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the methods of protecting JavaScript web applications/games?

Tags:

javascript

Back story: I'm planning to implement a casual game to be deployed in a webapp, but I don't want to use Flash, instead just plain Javascript. One benefit of Flash that I would want though is that it distributes a binary and not the source code so it's easier to protect your code from being reused/stolen by somebody else, or to prevent the client from modifying the code to "cheat" in the game?

So my question is: what are the ways to similarly protect a Javascript application? Am I limited to the usual methods of using a code obfuscator? Will that be enough?

like image 542
Roy Tang Avatar asked Jul 28 '10 19:07

Roy Tang


2 Answers

A code obfuscator is about all you can do. No matter what you do, the executable code will/must be available in the browser.

like image 177
Byron Sommardahl Avatar answered Oct 23 '22 16:10

Byron Sommardahl


Use AJAX to have your game verify against server code you control. This is also useful if the game is multi-player in someway. Verification prevents someone from changing the code in order to cheat.

Also Flash is not immune at all from being taken by someone else. People can download the binary and post it wherever they want. And Flash de-compilers do exist and are quite effective.

like image 32
Cfreak Avatar answered Oct 23 '22 17:10

Cfreak