gpt4 book ai didi

html - IE8后退按钮重置表单

转载 作者:太空宇宙 更新时间:2023-11-03 13:39:51 24 4
gpt4 key购买 nike

我在 ASP Classic 中有一个包含表单的页面,当用户提交表单时,他按下 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 的响应 header :

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";

关于html - IE8后退按钮重置表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27118384/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com