如何在ASP网中使用javascript禁用浏览器后退按钮

如何在ASP网中使用javascript禁用浏览器后退按钮

问题描述:

我想知道如何在asp net mvc5中使用java脚本禁用浏览器后退按钮,即使我不想返回按钮可点击。它只显示非可点击模式的后退按钮。



我有粘贴代码,但根据我的要求还不够..请告诉我如何制作它。



我尝试了什么:



函数DisableBackButton(){

window.history.forward()

}

DisableBackButton();

window.onload = DisableBackButton;

window.onpageshow = function(evt){if (evt.persisted)DisableBackButton()}

window.onunload = function(){void(0)}

I want to know how to disable browser back button using java script in asp net mvc5,even i don't want to be back button clickable.Its only show back button in non clickable mode.

I have paste code, but its not sufficient as per my requirement..tell me the way how to make it.

What I have tried:

function DisableBackButton() {
window.history.forward()
}
DisableBackButton();
window.onload = DisableBackButton;
window.onpageshow = function (evt) { if (evt.persisted) DisableBackButton() }
window.onunload = function () { void (0) }

这是在整个互联网上最常被问到的问题,请在提问前做基础研究



禁用后退按钮 - Google搜索 [ ^ ]



剧透警报:你不能。
This is the most frequently asked question on the whole internet, please do basic research before asking a question

disable back button - Google Search[^]

Spoiler alert: you can't.