Speed Up Your Javascript Load Time

Combine Your Files … why on heart no one talk about packed.it? It could combine in ONE file both CSS and JavaScript, merging them in a way that Rhino could not do!

At the same time, packed.it parses conditional comments as well, there’s JavaScript inside, but of course a JavaScript that Rhino could not understand.

Did I forget something? Yes, packed.it uses deflate before gzip, about 3% bigger but probably much more safer with old IE too?

Anyway, good stuff, and Kind Regards

[…] Speed Up Your Javascript Load Time Feb 26, 07 Javascript is becoming increasingly popular on websites, from loading dynamic data via AJAX to adding special effects to your page. Unfortunately, these features come at a price: you must often rely on heavy Javascript libraries that can add dozens or even hundreds of kilobytes to your page. Users hate waiting, so here are a few techniques you can use to trim down your sites. […]

[…] javascript optimization […]

[…] http://betterexplained.com/articles/speed-up-your-javascript-load-time/ […]

Microsoft to Force Upgrade IE6 to IE7. GREAT SITE AND INCLUDE SO MANY USEFUL INFORMATIONS :0 THX

I would also recommend this online free tool: http://Site-Perf.com/

It measure loading speed of page and it’s requisites (images/js/css) like browsers do and shows nice detailed chart - so you can easily spot bottlenecks.

Also very useful thing is that this tool is able to verify network quality of your server (packet loss level and ping delays).

[…] Best document in below http://betterexplained.com/articles/speed-up-your-javascript-load-time/ […]

Nice article. You can also mention about merging all javascript files into one - this would reduce the no tnx you!

[…] There are a number of ways you can go about speeding up your JavaScript load time. […]

This is a rather helpful post. My only concern with compression is debugging. I now decompress and recompress source code to debug it which makes it a living hell for the programmer. Another issue is backwards compatibility. I’ve seen strange behavior of a script of mine when i tested it with IE6 and IE7. IE6 acted weird (as usual?!)

Thanks.

@JustAnotherVictim: When you debug using gzip compression, you don’t have to worry about keeping two versions around (since it’s automatically decompressed by the browser). But if you do “Crunching” (removing whitespace/renaming variables) then you’re right, that can be a big problem. Backwards compatibility can be really annoying with older browsers – sometimes you have to do tests for them and not serve them compressed content.

[…] Speed Up Your Javascript Load Time The following article has been taken from http://betterexplained.com/articles/speed-up-your-javascript-load-time/ […]

@sklepy: Yes, I agree. For that reason I don’t really recommend minifying source code unless absolutely necessary – most of the gains will come from regular gzip compression of the output.

[…] @set dailylog=%date%.log @IF NOT EXIST %date%/%dailylog% echo ### > %date%/%dailylog% 如果檔案不存在就建立 Speed Up Your Javascript Load Time | BetterExplained # | javascript,tips […]

Thank you for this excellent tutorial on site optimisation!

it has been improved my speed. tnx

[…] Compression is a simple, effective way to save bandwidth and speed up your site. I hesitated when recommending gzip compression when speeding up your javascript because of problems in older browsers. […]

[…] Now, many websites compress Javascript code to remove unwanted whitespace and line-breaks to make the page load faster. In this process they also make the source extremely difficult to read. So how can an avid web developer unscramble the convoluted code? […]

Thanks for this awesome tutorial.
Even yahoo had release new version of YSlow.
It is also very helpfull.

Note that the “Forced IE7 upgrade” is not that forced, and is not for all IE6 users:

  1. IE6 users on Windows 2000 cannot upgrade to IE7 and will not be forced to do so.

  2. IE6 users on Windows XP/2003 will be forced to install IE7 only if they blindly allow the MS update mechanism to install any junk chosen by Microsoft, no questions asked. So IE6 on XP is still possible, although there might be no more security updates offered for it.

  3. Windows Vista users never had the option to run IE versions older than IE7.

P.S.
The safe way to handle gzip or deflate compression (the latter should be better than gzip but has more browser bugs) is to let the web server do this based on the headers in the request (“Accept-Encoding” and “User-Agent”). As someone mentioned, the Apache web server standard example configuration does this out of the box. For IIS and other web servers, configuration scripts may be available somewhere.