IE & JSON Caching Bug

I came across a weird bug. It seems that IE is the only browser that has a tendency insists on caching JSON results. I created a little api call that returned a list of users “favorites”. I use jQuery to retrieve this list and make updates to my site.

Well apparently IE caches the JSON file, so any changes are not reflected. Firefox and Safari seem to work fine. I tried a number of mime types (as I understand it, the defacto standard is application/json), but the only one that seemed to keep IE from caching it was text/plain. Go figure. And people wonder why developers hate IE so much…

Related posts:

  1. Django & Djson… er, JSON I must admin this is my first attempt at even...

Related posts brought to you by Yet Another Related Posts Plugin.

September 17, 2009  Tags: , , ,   Posted in: Programming & Internet

23 Responses

  1. Greg Milby - September 22, 2009

    no kiddin’!
    ie would at least be ‘usable’ if they stayed within one standard… creating a site for ie compliance entails a minimum of 3 standards (v.6,7 & 8)… so it’s like building a site for 6 browsers ( ie x 3 + chrome/safari, netscape/firefox & opera)…
    good post… short but well said :)

  2. David from Wedding Photographer - September 23, 2009

    A bit frustrating. There are quite a few things you can only do in IE as well, so in the end you find yourself running a few browsers. It’s not ideal but computers have always been like this. There’s always a glitch or a bug somewhere.

  3. Mack from Foreclosure Las Vegas - September 29, 2009

    I havent tried any hardcore plugin developments or api building just like you. But I was devastated with IE especially when i write CSS codes. I pray to god each time I press the F5 button after I tweak my code so that it looks perfect in IE. But most of the times IE makes it look distorted and I feel disgusted. I never hard any issues with firefox, opera or even chrome as a matter of fact. I can easily understand your feelings because there is more technicality like jquery being used and hence more frustration. But its good that you used the JavaScript Object Notation. I have heard it being the standard practice nowadays. Anyways I never allow IE to test my patience :P

    Regards,
    Mack McMillan

  4. Costa del sol wedding - October 12, 2009

    I find myself upgrading each version of IE when it comes out hoping it will be better than the last, still prefer Firefox.

  5. Cole from embroidery machine - October 19, 2009

    For me, Firefox is way more better than any IE. I’ve been using it for years already and had no issues about it so far.

  6. Nancy from blood pressure monitor - October 27, 2009

    Firefox is way faster and better than IE. Although i have one issue of firefox, it’s when you used it, the launching of firefox is long to wait.

  7. Laurie from popcorn popper - October 28, 2009

    Maybe IE must realize that they should need to upgrade mroe and become faster than ever. :)

  8. Las vegas Short sale Agent - October 29, 2009

    I’ve been using Firefox and everything seemed much more better than IE. Seemingly, in my point of view Firefox do better most especially when I open another tab, in comparison to IE it would open another window which is quiet disturbing.

  9. seo packages - October 30, 2009

    When you pick up the travel bug, on the page of the cache where you found the bug you should see an “Inventory” on the right side of the page, and your bug should be listed. Simply click on the link for the bug and you will be taken to the bug’s page. In the upper right corner of the page is a drop-down menu. Click on the “Found it? Log it!” link and fill in the required information.

  10. John Biaz from health and safety equipment - November 1, 2009

    i think this bug has been fixed in IE9, moreover if you still find problem i would advise you to directly to got microsoft website and download KB19192 patch for this bug, this will surely help you.

  11. Henderson Nevada - November 4, 2009

    All versions or just the latest version?

  12. Marc from xbox 360 ring of death - November 6, 2009

    I’m done with IE. I was mindlessly loyal to it for years until I couldn’t take its bugginess and sluggishness any longer. Happy with Firefox now. If Firefox ever gets as bad as IE, I’ll switch to google chrome.

  13. hao - November 12, 2009

    Before everyone starts hating IE for the wrong reasons, lets clarify a few things. This is about to sound pretty nerdy but since your blog title is “Nerdy Dork” I think I’m allowed to say it… Following the HTTP RFC, which states that “GET” requests are cache-able, IE is not at fault. Now that’s assuming you were using the “GET” method. The last time I checked jQuery’s documentation, if you have not specified the method, defaults to using “GET” method to make a request. Someone should call me out on that.

    To stop caching, trying using a “POST” method. If you’re using jQuery 1.2 or later, there’s even an option that you can use to turn off caching.

    http://docs.jquery.com/Ajax/jQuery.ajax#options

    If for whatever reason you cannot use “POST” and has to stick to a “GET”, then try using a cache busting method For instance, sticking a unique param at the end of your request url but be sure to use a param that won’t affect the outcome of JSON returned, other than it not being cached of course. ;)

  14. Dustin - November 12, 2009

    hao. I went back and verified, it is a POST method. Why would IE cache every mimetype except text/plain?

    Anyway, back to the IE hating! :P

  15. hao - November 13, 2009

    Hey Dustin, that’s is unfortunate… I hope you’ve found a solution you like to solve this problem.

    In regards to the IE mime-type issues, its been an on-going problem (like the CSS problems another commenter had mentioned above) for years. I think even IE 8 still has problems with mime-types…

    Anyway, I did forget to mention that I am an IE hater myself…

    So yes, back to hating IE. :D

  16. Vb Reader - November 15, 2009

    for caching this can be easily overridden by adding a query string and a timestamps to your arc attribute of the script. still i like IE over other browsers may be because i am a .net developer. I tried firefox, i cant say anything bad about firefox. but whenever IE comes with new versions. it simply force me to quit firefox to back to IE. again it is me it differs person to person.

  17. Alexis from Web Design London - November 22, 2009

    I was so loyal to IE for years but this autumn I have switched to FireFox and I have never looked back. More fool Microsoft.

  18. Jack from Arc Fault Breaker - November 30, 2009

    Yeah I have no idea why I didn’t make the switch to FF sooner. I wonder if the Chrome will start picking up more traction…
    -Jack

  19. Dustin - December 1, 2009

    Jack, I’m sure Chrome will gain traction now that they have support for extensions. That is what keeps people on Firefox. Everyone has their favorite extensions. What keeps me on Firefox? Adblock Plus, Last Pass, & Firebug mainly.

  20. ruby from okc wedding photographers - December 6, 2009

    I must admit that I am one of IE haters.Its more of love-hate relationship with IE since there are applications I can’t seem to run properly in Firefox.Thanks for the heads up on this one.Kudos!

  21. Mike from VOIP for business - December 22, 2009

    Too bad IE will always have a huge share of the market since practically all PCs come with IE as the main browser and most people don’t even have a clue about the other browsers out there and how to run them.

  22. Atniz from Work At Home - January 14, 2010

    I hate IE and stopped using it for few years now. I guess it will still be a major browser because it is owned by Microsoft.

  23. Vern from Medical Billing Jacksonville - February 4, 2010

    I also hate IE! Just giving me lot of aches browsing. So i stick with firefox ;)

Leave a Reply