js禁止浏览器页面刷新|js禁止浏览器页面后退功能的实例(推荐)

更新时间:2021-08-14    来源:浏览器    手机版     字体:

【www.bbyears.com--浏览器】

<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>

本文来源:http://www.bbyears.com/bangongshuma/135898.html

热门标签

更多>>

本类排行