如何在ASP网中使用javascript禁用浏览器后退按钮 [英] How to disable browser back button using javascript in ASP net

查看:72
本文介绍了如何在ASP网中使用javascript禁用浏览器后退按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



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



< b>我尝试了什么:



函数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.


这篇关于如何在ASP网中使用javascript禁用浏览器后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆