IE8后退按钮重置表单
问题描述:
我在ASP Classic中包含一个表单,当用户提交表单时他按下IE8的后退按钮并且他再次填充表单,他重用了几乎所有他输入的数据先前。IE8后退按钮重置表单
我们刚在网站上实现了SSL,现在当用户点击IE8的后退按钮时,表单的字段被重置。我在Chrome中测试了它,它保持了窗体的状态,但是IE8没有。
如何强制IE8在按下后退按钮时不清除表单的内容?
这是IE8的响应头:
Key Value
Response HTTP/1.1 200 OK
Date Tue, 25 Nov 2014 03:04:49 GMT
Server Microsoft-IIS/6.0
X-Powered-By ASP.NET
pragma no-cache
cache-control private
Content-Type text/html
Expires Sat, 15 May 1999 04:00:00 GMT
Cache-control private
Transfer-Encoding chunked
Set-Cookie asdfommited; Expires=Tue, 25-Nov-2014 04:04:15 GMT; Path=/
Set-Cookie asdfommited; Expires=Tue, 25-Nov-2014 04:04:15 GMT; Path=/
这是Chrome的响应头:
Request Headers:
Provisional headers are shown
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Referer:https://www.ommited.com
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.65 Safari/537.36
Resonse Headers:
cache-control:private, private
Content-Encoding:gzip
Content-Type:text/html
Date:Tue, 25 Nov 2014 02:57:49 GMT
Expires:Sat, 15 May 1999 04:00:00 GMT
pragma:no-cache
Server:Microsoft-IIS/6.0
Vary:Accept-encoding
X-Powered-By:ASP.NET
答
我发现是什么原因导致的问题。以下说明位于ASP页面中,强制页面不使用缓存。我刚刚删除了这些行,现在当退格键被按下时,它显示先前在表单中输入的值。
Response.Expires=15;
Response.ExpiresAbsolute = 'May 15, 1999';
Response.AddHeader ("pragma", "no-cache");
Response.AddHeader ("cache-control", "private");
Response.CacheControl = "private";