On 12/03/2008, at 1:06 PM, Nathan Andelin wrote:

I recently began looking at JavaScript compression options. Some of the
tools I tried obfuscate the code in addition to compressing it. All of
the tools I tried created code that wasn't runable, which seemed like an
irony to me. I finally created a CL command and RPG program to compress
all JavaScript files in one directory and output them to another. My
compression algorithm is pretty basic; It removes all comments and
attempts to remove unnecessary white space, but doesn't do anything
fancy to obfuscate the code. Is anybody else compressing their
JavaScript? Have a recommended tool?

Why don't you let the browser and server deal with the compression issue? Modern browsers usually send a request header indicating compression is handled (usually gzip or flate). Modern web servers will, or can be configured to, honour that request. Both those compression algorithms do a reasonable job.

Removing comments will help reduce the amount of data to compress but unless you've got LOTS of comments you may find the bandwidth reduction not worth the effort.

I thought most sites had given up on the idea of code obfuscation in Javascript--partly for the reason you encountered.

Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists

http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.