Uncache IE Ajax Cache (XHR GET)

In IE (v: 7.0.5730.11) all GET request are cached. Go figure why.

In order to solve this issue, you can either switch to POST, or add a time stamp to any url you send.

function uncache (url){
return url + "&uncache=" + new Date().getTime();


4 Comments on “Uncache IE Ajax Cache (XHR GET)”

  1. Mike says:

    Thanks! This neat trick saved me from rewriting a script for a webshop I just built! I knew IE sucks, but didn’t have any idea they’ve gone this far to make the programmer’s life a hell :) j/k

  2. Toi says:

    Thanks, this is very nice trick. I have spent many hours for this problem.

  3. ujjwal b soni says:


    Its really one of the most orsom scripts, saved lot of time….


    Ujjwal B Soni

  4. Lars Guitars says:

    Nowadays with MVC frameworks and the popularization of url rewriting to map query string params to url segments…

    http://host/folder/page?var1=param1&var2=param2 becomes

    sometimes it may be more useful to use either a POST parameter rather than a GET – or force no-cache in the response headers server side. Code for both methods can be found at http://thecodeabode.blogspot.com/2010/10/cache-busting-ajax-requests-in-ie.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s