Magento Javascript Loading Bug
While looking at Magento performance via Pingdom, I noticed that Pingdom was indicating that a particular URL was not being loaded. Upon closer inspection, it turned out to be the Javascript loading php script. Obviously, this is not a good sign so I decided to investigate further.
It turns out that the URL used includes an & that is not properly understood by some HTTP clients including pingdom and curl. To fix this, you need to edit app/code/core/Mage/Page/Block/Html/Head.php and change the 2 instances of “&,” to “&”.
I have also published the change at github so you may use that if you wish.
On a different note, it is probably not the best idea to aggregate Javascript in such a fashion. As noted in Cal Henderson’s Serving Javascript Fast,
According the letter of the HTTP caching specification, user agents should never cache URLs with query strings. While Internet Explorer and Firefox ignore this, Opera and Safari don’t - to make sure all user agents can cache your resources, we need to keep query strings out of their URLs.
While Magento is notable for its flexibility,in general it’s a good idea to aggregate all the JS files and send it down the pipe just once with a long Expires setting rather than having different pages with various combinations of Javascript files concatenated together as a) you lose the benefit of caching the js and b) you are potentially resending portions of the same data multiple times.
