Back button caching in Internet Explorer 10

In Internet Explorer 10, if you click the back button, it will try to extract the previous page from the browser cache. This behavior is different from almost any other browser, including IE9, in which pressing the back button will completely reload the previous page instead of reusing the cache.

How can I interact with IE10 from the site, possibly using javascript / headers, etc., so as not to use this cache usage for the site globally?

(Note. I am not looking for IE10 settings to disable this. I am looking for a solution that can be implemented on the Site, not a browser, to tell IE10 not to use this cache for the back button), I am also looking for a global solution that works for each page of the site ...

I am using PHP / jquery for the site

, so here is more information

The page is a form. It contains some dynamically loaded information. (Suppose it contains the number of times a user accesses a form)

You click the submit button. You will then be redirected to the form’s action page.

Then you click the back button.

In every other browser, it reloads the original form with the updated "number of times the user submitted the form." In IE10, however, this does not happen .... How to do it in IE 10.

Here are some sample headers:

1. When you first load the form:

Request header

Key Value Request GET /path/to/my/page HTTP/1.1 Accept text/html, application/xhtml+xml, */* Accept-Language en-US User-Agent Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0) Accept-Encoding gzip, deflate Host myhost.com If-Modified-Since Tue, 10 Sep 2013 23:55:33 GMT If-None-Match "1378857333" DNT 1 Connection Keep-Alive Cookie __utma=104299925.1011127538.1340896287.1364829735.1378764406.12; __utmz=104299925.1340896287.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); has_js=1; __utmc=104299925; __qca=P0-1247924781-1340896285157; _mkto_trk=id:601-CPX-764&token:_mch-sadfsadfze.com-1358808312889-73607; __utma=171146939.775168663.1343066079.1375907514.1378762647.41; __utmz=171146939.1343066079.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); s_stats_browser_info=%7B%22pluginInfo%22%3A%7B%22pdf%22%3A%5B%22pdf%22%2C%22application/pdf%22%2C%220%22%5D%2C%22quicktime%22%3A%5B%22qt%22%2C%22video/quicktime%22%2C%220%22%5D%2C%22realplayer%22%3A%5B%22realp%22%2C%22audio/x-pn-realaudio-plugin%22%2C%220%22%5D%2C%22wma%22%3A%5B%22wma%22%2C%22application/x-mplayer2%22%2C%220%22%5D%2C%22director%22%3A%5B%22dir%22%2C%22application/x-director%22%2C%220%22%5D%2C%22flash%22%3A%5B%22fla%22%2C%22application/x-shockwave-flash%22%2C%220%22%5D%2C%22java%22%3A%5B%22java%22%2C%22application/x-java-vm%22%2C%221%22%5D%2C%22gears%22%3A%5B%22gears%22%2C%22application/x-googlegears%22%2C%220%22%5D%2C%22silverlight%22%3A%5B%22ag%22%2C%22application/x-silverlight%22%2C%220%22%5D%7D%2C%22res%22%3A%221920x1080%22%7D; _pk_id.2.1644=19232922ec6753dc.1371502517.1.1371502630.1371502517.; SESS569093948b0206b05eb2212616da3db6=1977iogjr841af2s8l4sd1cjd0; XDEBUG_SESSION=12250; has_js=1; __utmc=171146939 

Answer Header:

 > Key Value Response HTTP/1.1 200 OK Date Tue, 10 Sep 2013 23:55:44 GMT > Server Apache/2.2.20 (Ubuntu) X-Powered-By PHP/5.4.15-1~tooptee10+1 > Last-Modified Tue, 10 Sep 2013 23:55:44 +0000 Cache-Control no-cache, > must-revalidate, post-check=0, pre-check=0 ETag "1378857344" > Keep-Alive timeout=15, max=9987 Connection Keep-Alive > Content-Type text/html; charset=utf-8 

2. When you click the back button to return to this form

Request header

 > Key Value > Request GET /path/to/my/page HTTP/1.1 > Accept text/html, application/xhtml+xml, */* > Accept-Language en-US > User-Agent Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0) > Accept-Encoding gzip, deflate > Host myhost.com 

Answer Header

 > Key Value Response HTTP/1.1 304 Not Modified > X-Powered-By PHP/5.4.15-1~tooptee10+1 ETag "1378857344" > Keep-Alive timeout=15, max=9987 Content-Type text/html; charset=utf-8 > Content-Length 117183 Expires Tue, 10 Sep 2013 22:55:36 GMT > Last-Modified Tue, 10 Sep 2013 23:55:44 GMT 

Note that it ends return 304. When I tried this in Firefox, it returned 200 when you click the back button.

+3
javascript internet-explorer php caching back
source share
2 answers

I think the behavior you want is a behavior that violates the expectations of the back button for users.

Users expect that when they return, they will return them back to the page that they previously viewed, in the state in which it was when they left it. Most modern browsers achieve this by not only caching the page, but also by storing the state of the page (including the Javascript context) in memory, so when returning to the page using the back button, it is in the same state it was in before, including everything they wrote in forms or any Javascript that they interacted with.

In most browsers, you can force this override by setting Cache-Control headers such as no-cache and no-store . I don't know if the no-store work in your case for IE10, or if IE10 ignores this and just returns to the page anyway. If this happened, I do not think that I really blame him. It does this in the interests of users both quick and return to the page, as it was when it was viewed before.

I think the approach that I will take and you should not agree with me is to change your mind about the design. Why do you require users to hit back if you are not going to show them the same thing you saw when they were there? If you want to show an updated form, why redirect after POST back to a form that will be considered a new page load and read your Cache-Control headers? This is what I would do, and it would become the de facto standard.

tl; dr is possible, but I'm not sure that you could do what you want using the no-store , but I would look at the switch to redirect after POST so as not to rely on the back button for anything else how to return to the previous state.

+1
source share

You can set some headers in PHP

 Cache-Control: private, must-revalidate, max-age=0 Expires: Thu, 01 Jan 1970 00:00:00 
0
source share

All Articles