
Do you obfuscate JavaScript, and how? - Tichy

======
Tichy
For the time being I use this obfuscator:
<http://www.daven.se/usefulstuff/javascript-obfuscator.html> but it seems to
have bugs, and perhaps the obfucation could be better, too. Are there better
alternatives (preferably open source)?

------
wehriam
Dojo's "ShrinkSafe" compresses Javascript, rendering it virtually unreadable
and considerably smaller. From the documentation at
<http://dojotoolkit.org/docs/shrinksafe> :

 __ _

To demo our compression system, let's build an example that we want to
compress. Here's the listing for infile.js:

function MyClass(){ this.foo = function(argument1, argument2){ var addedArgs =
parseInt(argument1)+parseInt(argument2); return addedArgs; }

var anonymousInnerFunction = function(){ // do stuff here! } }

function MyFunc(){ // this is a top-level function }

// we've got multiple lines of whitespace here

We run it through the compressor with this command to generate outfile.js:

java -jar custom_rhino.jar -c infile.js outfile.js 2&1

And the contents of outfile.js should now look something like:

function MyClass(){ this.foo=function(_1,_2){ var
_3=parseInt(_1)+parseInt(_2); return _3; }; var _4=function(){ }; } function
MyFunc(){ }

------
jsjenkins168
Probably not what you're looking for, but GWT can obfuscate its compiled
Javascript with a command-line option. Seems to be bug free to me and is nice
because its totally transparent to the developer.

