更新时间:2023-12-03 08:40:40
code:
< HTML>
&所述; HEAD>
<脚本类型=文/ JavaScript的>
window.history.forward();
功能noBack(){
window.history.forward();
}
< / SCRIPT>
< / HEAD>
&所述; BODY onload事件=noBack(); onpageshow =如果(event.persisted)noBack(); onunload的=>
< / BODY>
< / HTML>
I would like to Disable Back button when user click on logoff for this i delete only cookies of that user not session in my application. And want to disable Back button
if(getCookie('username') == ""){
Disable back button;// we use "window.history.redirect" for javascript i look jquery for this
}
Please help me..
This is another technique to disable the back functionality in any webpage. We can disable the back navigation by adding following code in the webpage. Now the catch here is that you have to add this code in all the pages where you want to avoid user to get back from previous page. For example user follows the navigation page1 -> page2. And you want to stop user from page2 to go back to page1. In this case all following code in page1.
CODE:
<HTML>
<HEAD>
<SCRIPT type="text/javascript">
window.history.forward();
function noBack() {
window.history.forward();
}
</SCRIPT>
</HEAD>
<BODY onload="noBack();" onpageshow="if (event.persisted) noBack();" onunload="">
</BODY>
</HTML>