Online JavaScript Compression Tool

Compressing JavaScript code is useful when you want to minimize the size of files that get downloaded to the client.  This is especially true with AJAX applications that may rely on several scripts to function properly.

I was playing around with Douglas Crockford's JsMin code last night and decided to put together an online version that people could use on my XML for ASP.NET Website.  It's not throughly tested at this point, but feel free to try it out and let me know of any issues.  The tool can be found at the following URL:

http://www.xmlforasp.net/JSCompressor.aspx

comments powered by Disqus

2 Comments

  • Hmmm. In the days that every browser supports gzip and can cache images and scripts - Why is compression like this needed? Most people don't even pull carriage returns and whitespace out of their HTML because gzip will take care of it for them.
    The only good reasons that I have heard so far are:
    1. If you only expect a user to visit your site once and never come back. Then their initial load time may be shortened slightly.
    2. Adds some level of obfuscation in case you are worried that someone will reuse your great new control.(Not sure I care on that one)


    Can you think of any other reason? I thought compression was a pre 1999 thing.

  • You're absolutely right, although we can't always count on a browser handling the compression or a Web server having it enabled. In most cases compression will be used of course so this would be overkill. However, by compressing larger scripts you're ready for any situation. You'll find that all of the major script libraries (prototype, MS AJAX, etc.) provide a compressed version.

Comments have been disabled for this content.