Maximize Your Chances of Caching Your jQuery

added by BucketSoft
3/9/2012 9:43:40 AM

4 Kicks, 212 Views

A couple lessons learned. 1. Use one of the popular CDN-hosted copies of jQuery. 2. Link to an exact version number.


3 comments

dpeterson
3/9/2012 9:42:00 AM
I wasn't even aware of the different cache controls in place on those resources, I always use the Google CDN for an explicit version. In addition to the caching, I would recommend everyone do the same to avoid compatibility problems breaking your site before you have a chance to test.

BucketSoft
3/9/2012 12:20:08 PM
Exactly. Yeah the jQuery team tries to avoid making breaking changes, but they have a made a few over the years. The one that hit me was the changes in the attr() function in jQuery 1.6. This broke a site I was working on and I found out that I should switch to the prop() function for what I was doing.

dpeterson
3/9/2012 1:11:38 PM
I was bitten by that exact same bug. I've also had issues with plugins that were doing things incorrectly or taking advantage of undocumented features suddenly breaking after minor version releases.