html – 如何在后退按钮点击过期页面?

html – 如何在后退按钮点击过期页面?,第1张

概述我在jsp页面中添加了以下元标记 <html><head><title>xyz</title><link type='text/css' rel="stylesheet" href="sdsds/sdsd"/><meta content="max-age=0" http-equiv="cache-control"><meta content="no-store" http-equiv=" 我在Jsp页面中添加了以下元标记
<HTML><head><Title>xyz</Title><link type='text/CSS' rel="stylesheet" href="sdsds/sdsd"/><Meta content="max-age=0" http-equiv="cache-control"><Meta content="no-store" http-equiv="cache-control"><Meta content="-1" http-equiv="expires"><Meta content="Tue,01 Jan 1980 1:00:00 GMT" http-equiv="expires"><Meta content="no-cache" http-equiv="pragma"></head><body><h1>Jsdsdsds</h1><a href="abc">click me</a></body></HTML>

通过单击链接“单击我”导航后,我将打开一个新页面.当我点击后退按钮它正在工作..我希望页面过期..
注意:在两个Jsp页面中我添加了相同的元标记.
我尝试添加这个

<%@ page import="java.lang.*" %><%// Set to expire far in the past.response.setheader("Expires","Sat,6 May 1971 12:00:00 GMT");// Set standard http/1.1 no-cache headers.response.setheader("Cache-Control","no-store,no-cache,must-revalIDate");// Set IE extended http/1.1 no-cache headers (use addheader).response.addheader("Cache-Control","post-check=0,pre-check=0");// Set standard http/1.0 no-cache header.response.setheader("Pragma","no-cache");response.setDateheader ("Expires",0); //prevents caching at the proxy server%>

以上HTML和内部head ..还有我可以看到后页.,
在mozilla firefox 10.0和ie8中测试过
有什么建议吗?

解决方法 只要不涉及会话,您就无法使浏览器的后退按钮上的页面过期.它可以用于反向浏览许多用户所执行的页面,因此这取决于您希望用户浏览您的站点的方式.你实际上需要处理浏览器的后退按钮.有几种方法可以做到这一点.
突出的一个是在JavaScript中使用这个代码:`
window.history.forward();

`
但它会将您的后退请求转发到历史记录中的当前页面
对我有用的是:

<script type="text/JavaScript">function noBack(){            location.replace(logouturl);            window.location="logouturl";}

HTML

<input type="button" value="SignOut" onclick="noBack()" align="mIDdle">
总结

以上是内存溢出为你收集整理的html – 如何在后退按钮点击过期页面?全部内容,希望文章能够帮你解决html – 如何在后退按钮点击过期页面?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1104531.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-28
下一篇2022-05-28

发表评论

登录后才能评论

评论列表(0条)

    保存