[英]How to disable back,forward and Refresh functionality in browser?
Can anyone help me to disable browser back,forward, back button and right click menu functionality using JavaScript or JQuery? 任何人都可以帮助我使用JavaScript或JQuery禁用浏览器后退,前进,后退按钮和右键菜单功能吗? I have tried disabling the back button like this:
我试过像这样禁用后退按钮:
function disableBackButton() {
window.history.forward();
}
setTimeout("disableBackButton()", 0);
I have called this function in the Body onload
event. 我在Body
onload
事件中调用了这个函数。 I have a doubt that where we need to put this code in the Calling page or Called Page.Suppose i have two pages like this FirstPage.aspx
and SecondPage.aspx
. 我怀疑我们需要将此代码放在Calling页面或Called Page.Suppose中我有两个页面,如
FirstPage.aspx
和SecondPage.aspx
。 When I navigate from the First Page to Second Page when I click back button of the browser it should not go to FirstPage.aspx
. 当我单击浏览器的后退按钮时,从第一页导航到第二页时,它不应该转到
FirstPage.aspx
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.