Sunday, April 8, 2012

To hide your Javascript code from the users

Sometimes you may want to hide or encrypt your Javascript code. We have an online tool JavaScript Compiler and Encoder that can encode your Javascript code to make it obfuscated so that it is hard to read by a human.

To use it, just paste your original source code into the *Your source code* box and click on the *GO* button. The source code will be sent to the Closure Compiler (by Google) online service to get compiled. The result will be shown in the *Compiled code* box. If your source code contains errors or warnings, the error or warning messages will be shown instead of the compiled code, and it will stop there. If your source code is good, the compiled code will be encoded and the result will be shown in the last *Encoded code* box.

If you know the warnings returned from the Closure Compiler is trivial and you can live with it -- not recommended, you can let the tool ignore the warnings by checking *Ignore Warnings*.

This tool helps to obfuscate your code. But you should know that because JavaScript code runs on the client side, it must be fully downloaded by the browser to run. That means the code will be in the users' machine and the determined users can still get your code.

This tool is not supported in the old browsers, e.g. Firefox 3.6. If it does not work on your browser, please try upgrade your browser. It does not work on IE 9. IE 10 starts to support XMLHttpRequest so most likely it could work on IE 10.

No comments:

Get This <