AJAX - The Complete Reference

(avery) #1

296 Part II: Developing an Ajax Library^


Going further and replacing variable names and remapping existing objects, the code can
be made much smaller and more unreadable even with whitespace added as shown here.

As you can see, it really doesn’t matter if the whitespace was added back; the person
viewing it will still have a harder time inferring meaning from the variables, function, and
object names.
If the aim is more obfuscation than size reduction, complex-looking names that look
similar, or even binary like can be employed to make a hand trace more difficult.

Another consideration would be putting function code in place rather than outside as a
call, though you have to be careful as file size begins to increase by doing this; the same
might be said about the next techniques.

Encoding and Encrypting JavaScript
More protection can be added by encoding strings or even the whole script and then
evaluating it back to normal by running a decoding function.
Free download pdf