Preventing page caching in Internet Explorer 8

On my page in IE8, I have text that changes through the admin panel. For example: if the page contains the text "hello world", after 5 minutes the text may differ depending on whether the administrator has changed.

A problem with IE8, which caches the page and displays the same text again. If we clear the cache and update, the text will be updated.

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

I saw that if I select options for the Internet β†’ browsing history (settings) β†’ every time I visit a web page, the problem is fixed; but if it is set to automatic, a cache page is displayed.

Is there a way to force "no caching" even if the caching option in IE8 is set to automatic by the end user?

+6
source share
3 answers

You can prevent Internet Explorer from caching your page by using the following headers:

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

β†ͺ See How to manage web page caching in all browsers?

+4
source

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

For example, if your page URL is:

www.abc.com/hello.php

do this:

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

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

+2
source

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

+1
source

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


All Articles