当我在浏览器上的后退按钮点击我仍然得到背靠背页 [英] When i click on back button of the browser i still get back to back page
问题描述
我用 Session.Abandon();
Session.Clear();
关于注销按钮并重定向到登录页面。
但
当我在浏览器上的后退按钮点击我仍然得到背靠背的页面。
I have used Session.Abandon();
Session.Clear();
on Logout Button and redirected to Login page.
BUT
When i click on back button of the browser i still get back to back page.
推荐答案
由于它是从缓存中读取页面,你可能要禁用缓存为那些相关的网页。
Because it is fetching page from cache, you may want to disable cache for those respective page.
有些人要求禁用后退按钮,它是不可能禁用后退按钮。替代品:
Some people asks for disabling back button, it is not possible to disable back button. Alternatives are:
- prevent缓存的页面
- $来自回去一旦用户退出应用程序的对$ pvent用户。
有关第二种情况,检查出低于code和把它放在你的登录页面。
For second case, check out the below code and put it in your login page.
<script type = "text/javascript" >
function changeHashOnLoad() {
window.location.href += "#";
setTimeout("changeHashAgain()", "50");
}
function changeHashAgain() {
window.location.href += "1";
}
var storedHash = window.location.hash;
window.setInterval(function () {
if (window.location.hash != storedHash) {
window.location.hash = storedHash;
}
}, 50);
</script>
和调用它象下面这样:
<body onload="changeHashOnLoad(); ">
//---Rest of your code
这将在所有的浏览器。
It will work in all the browser.
来源:SO(没有链接到原来的线程)
Source: SO (don't have link to the original thread)
这篇关于当我在浏览器上的后退按钮点击我仍然得到背靠背页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!