Response.CacheControl 在 Firefox 或 Chrome 中不起作用
我在 global.asax.vb 中有这段代码,用于禁用后退按钮。
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
Response.Buffer = True
Response.ExpiresAbsolute = Now().Subtract(New TimeSpan(1, 0, 0, 0))
Response.Expires = -1
Response.CacheControl = "no-cache"
End Sub
该代码在 IE 中完美运行,但在任何其他浏览器(如 Firefox 或 Chrome)中无法运行。我该怎么做才能使其成为多浏览器?
i have this code in global.asax.vb, to disable the back button.
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
Response.Buffer = True
Response.ExpiresAbsolute = Now().Subtract(New TimeSpan(1, 0, 0, 0))
Response.Expires = -1
Response.CacheControl = "no-cache"
End Sub
this code works perfect in IE, but refuses to work in any other browser like firefox or chrome. what can i do to make it multi browser?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要参考 这篇文章。它给出的答案是同时使用“no-cache”(对于 IE)和“no-store”(对于 Firefox)。使用“no-store”的原因是:“缺乏无缓存支持仅限于 Firefox 3.0 的早期版本,并且是由错误引起的。尽管现在单独的无缓存应该可以工作,但访问者可能会您的网站将运行受影响的 Firefox 版本。”
You might want to refer to this article. The answer it gives is to use both "no-cache" (for IE) and "no-store" (for Firefox). The reason for using "no-store" is because: "The lack of no-cache support is limited to early versions of Firefox 3.0 and was cause by a bug. Although, no-cache alone should now work it is possible that visitors to your site will be running affected versions of Firefox."