Search code examples
javascripthtmlhide

Is it possible to hide or scramble/obfuscate the javascript code of a webpage?


I understand that client side code must be readable from the browser but I wonder (since there are too many things that I ignore) if there are ways to obfuscate to code to the end user and, if not what is the best practice to "pack" the javascript code.


Solution

  • It is good practice to minify your JS with a tool such as YUI Compressor. I would not obfuscate it unless you have a specific need to do this. There are plenty of online obfuscators such as this one

    See this article: http://developer.yahoo.net/blog/archives/2007/07/high_performanc_8.html