IE8 still caches my requests even with mathrandom

TL; DR IE still caches my requests even with the Math.random () URL included.


So, I added a math error to the end of my URL:

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

I also added a math error to my param function:

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 looks like http: // host / data / pattern? Key = 35678652545 , etc.

It changes every time a query is executed.

It works in Firefox, Chrome and Safari, etc. But IE8 still caches data and does not update its layer.

Any ideas as to why this could happen?


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 caching data. Any other ideas?

+3
2
+2

IE AJAX. (, , AJAX-?) , IE HTTP-, AJAX.

URL-, : http://greenash.net.au/thoughts/2006/03/an-ie-ajax-gotcha-page-caching/

, HTTP, , :

Pragma: no-cache
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0

... -.

+2

Source: https://habr.com/ru/post/1749143/


All Articles