IE8 is still caching my requests even with mathrandom.

Posted by Ozaki on Stack Overflow See other posts from Stack Overflow or by Ozaki
Published on 2010-06-09T03:35:53Z Indexed on 2010/06/09 3:42 UTC
Read the original article Hit count: 136

TLDR IE is still caching my requests even with Math.random() included in the URL.


So I added math random onto the end of my url:

var MYKMLURL = 'http://' + host + 'data/pattern?key='+ Math.random();

I also added math random onto my function param:

window.setTimeout(RefreshPatternData, 1000, MYKMLLAYER);


           function RefreshPatternData(layer) {
               layer.loaded = false;
               layer.setVisibility(true);
               layer.refresh({ force: true, params: { 'key': Math.random()} });
               setTimeout(RefreshPatternData, 30000, MYKMLLAYER);
           }

So the request appears as http://host/data/pattern?key=35678652545 etc.

It changes everytime the request is made.

It works in Firefox & Chrome & Safari etc. But IE8 is still caching the data and not updating my layer.

Any ideas as to why this might be occuring?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery