jQuery bug - Ajax ‘no-cache’ parameter

December 3rd, 2007

In jQuery 1.2.1, when using the $.ajax function with cache: false, jQuery appends a parameter with the current timestamp to the URL. This parameter makes the URL unique and therefore prevents subsequent request from being retrieved from the browser cache.

However, the code that adds this ‘no-cache’ parameter does not check to see if it already exists and so under certain circumstances you can end up with URL’s that look like:

http://mysite.com/file.html?_=1196716041523&_=1196716462963&_=1196716464245

It certainly makes the URL unique :)

I opened a ticket and submitted a patch, which was quickly optimized by a jQuery developer, davidserduke.

It’s nice to see a project with responsive, helpful developers.

Bookmark:
  • Digg
  • del.icio.us
  • Technorati
  • StumbleUpon
  • Reddit
  • Ma.gnolia
  • Facebook
  • Furl
  • Fark
  • Google
  • Slashdot

Tags: , , ,

Leave a Reply

If you'd like to post code in your comment, please wrap your code with a pre and code tag. For example, <pre><code>CODE</code></pre>. Additionally, you'll need to escape the HTML entities (try Postable), otherwise the code will not display properly.