js禁止浏览器页面后退功能的实例(推荐)
时间:2021-04-25 10:12:29|栏目:JavaScript代码|点击: 次
实例如下所示:
<script>
$(function(){
if(window.location.href.indexOf("/login") > -1) {
//防止页面后退
history.pushState(null, null, document.URL);
window.addEventListener('popstate', function () {
history.pushState(null, null, document.URL);
});
}
});
</script>
栏 目:JavaScript代码
下一篇:js实现按钮开关单机下拉菜单效果
本文标题:js禁止浏览器页面后退功能的实例(推荐)
本文地址:http://www.codeinn.net/misctech/108655.html






