Search code examples
javascriptjqueryinternet-explorercachingopenlayers

IE8 is still caching my requests even with mathrandom


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?


So i added:

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">

Still is caching the data. Any further ideas?


Solution

  • You could try the answers to this post:

    Prevent IE caching