I’m writing quite a bit of Javascript lately for an Ajax application using the Google Maps API. I have a couple concerns once I’m finished… the application security as well as simply protecting my hard work from someone grabbing it. I’m not sure how far I’m going to go, but I read about Javascript Obfuscation in one of my books, AJAX HACKS.
Javascript Obfuscation is actually pretty cool. It doesn’t necessarily protect your script from theft, but it does make it much more difficult by renaming the variables and removing any formatting. By removing white space, formatting, and reducing the size of the names of your variables, there is an additional benefit – reducing the size of your script file. This will help to load your pages faster. I did a test for a 4k script and it saved it down to about 2.5k! Not bad.
NOTE: If you’re thinking about doing this, one note of caution. Google has strict naming references with their API, so be sure not to replace those variables with other names! It won’t work.
I wound up purchasing a nice little app from Javascript Source. There’s an example of the results of running the script up on their site. Here’s a screenshot:
Now, about getting tipped. If you’ve not read The Tipping Point by Malcolm Gladwell, it’s an interesting read. I don’t want to destroy Mr. Gladwell’s words, but basically it speaks to the fact that, often, there seems to be a tipping point to decisions we make or in the actual events that unfold in our business and our lives.
After putting in my credit card information to process my purchase, there was an additional check box where I could pay $4.99 so that the company would maintain my registration information in the event that I lost it and needed to re-install and re-register the program. I thought about it for a few minutes… and checked the box. I remembered having to email another vendor when I had lost the registration key for their application and needed to reload it.
I bit! I’ll most likely never write and ask them for the key, but I paid $4.99 for that warm fuzzy feeling. I’m not upset – it’s actually a reasonable price to maintain my information. I’m surprised other vendors don’t do this as well. This is the kind of scenario that Gladwell talks about in his book. I was already sold on the software, they simply asked me for a little more after I had already committed. Nice!
