I need disable the browser back button after the window alert.
在page1.aspx中,我这样放置
**$(document).ready(function () {
function disableBack() { window.history.forward() }
window.onload = disableBack();
window.onpageshow = function (evt) { if (evt.persisted) disableBack() }
});**
在Page2.aspx中
I put alert message when button click.once close the alert message i press the back button.
same alert show when each click of back button.
(如何防止在按下后退按钮时发出警报消息)
答案 0 :(得分:2)
尝试一下:
jQuery(document).ready(function(){history.pushState(null, null, location.href);
window.onpopstate = function () {
history.go(1);
};})