6

On my page in IE8, I have got some text which gets changed through an admin panel. For example: if the page contains the text 'hello world', after 5 minutes the text could be different depending upon if the admin has changed it.

The problem is with IE8 which caches the page and shows the same text again. If we clear the cache and refresh, the text is updated.

I am using <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> tag to make refrain the browser from caching.

I have seen that if I select Internet optionsbrowsing history (settings) → every time I visit the web page, the problem is eliminated; but if it's set to automatic, the page's cached version is shown.

Is there a way I can force 'no-caching' even if the caching option in IE8 is set to automatic, by the end-user?

user2428118
  • 7,499
  • 4
  • 41
  • 69
samach
  • 2,854
  • 10
  • 37
  • 51
  • Possible duplicate of [Making sure a web page is not cached, across all browsers](http://stackoverflow.com/questions/49547/making-sure-a-web-page-is-not-cached-across-all-browsers) – BalusC Sep 02 '16 at 12:19

3 Answers3

4

You can force Internet Explorer not to cache your page using the following headers:

Expires: -1
Cache-Control: private, max-age=0

↪ See How to control web page caching, across all browsers?

Community
  • 1
  • 1
user2428118
  • 7,499
  • 4
  • 41
  • 69
2

The best way to disable cache is to use a variable with random unique value in your URLs.

For example if your page's URL is:

www.abc.com/hello.php

make it like:

www.abc.com/hello.php?randomVar=1SH232X-182N19-1929SK

You can use the current timestamp as the value of randomVar. This way, the page will not be cached.

Adil Malik
  • 5,813
  • 7
  • 44
  • 74
1

When you request the page by POST method instead of GET, you can be pretty sure it will be never cached. User1419007's answer is also correct.

Václav Dajbych
  • 2,349
  • 1
  • 27
  • 43
  • This doesn't hold true for IE 8 in all circumstances, IIRC – Robert Christ Jan 13 '14 at 23:34
  • using POST and sending mentioned headers is probably as good as it gets, but one can never be 100% sure, especially that really Internet Explorer behavior is not always exactly as documented. – MichaelS Mar 18 '14 at 10:37