IE 表现异常
我们根据用户在下拉列表中选择的值通过 JavaScript 设置 Window.Location。我们设置位置的 url 没有显式设置 HTTP 缓存。
然而,我们观察到,在某些情况下,过期标头会被设置为未来 1 秒。每当发生这种情况时,更改 window.location 将停止对后续请求起作用(即使等待超过一秒),因为 IE 会缓存响应。
响应标题:
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=utf-8
Date: Wed, 04 Nov 2009 10:51:22 GMT
Expires: Wed, 04 Nov 2009 10:51:23 GMT
ETag: 0
Vary: Accept-Encoding
Server: Microsoft-IIS/7.0
X-AspNetMvc-Version: 1.0
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Content-Length: 23405
我们所做的事情有问题吗?
亲切的问候,
We are setting Window.Location through JavaScript depending on the value selected by the user in a dropdown. The url we are setting the location to does not have HTTP Caching set up explicitly.
However, we have observed that in certain cases, the expires header is set in the future by 1 second. Whenever this happens, changing window.location stops working for subsequent requests (even after waiting out for more than a second) as IE caches the response.
The Response Headers:
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=utf-8
Date: Wed, 04 Nov 2009 10:51:22 GMT
Expires: Wed, 04 Nov 2009 10:51:23 GMT
ETag: 0
Vary: Accept-Encoding
Server: Microsoft-IIS/7.0
X-AspNetMvc-Version: 1.0
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Content-Length: 23405
Is there something wrong with what we are doing?
Kind regards,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将随机参数附加到 url 中。
因此,
您可以使用“
由于该“不同”页面尚未在缓存中”,浏览器将被迫重新加载它。
Append a random parameter to the url.
So, instead of
you could use
Since that "different" page is not in the cache yet, the browser will be forced to load it fresh.