Browser back key processing and an unexpected safety surprise!

//每次进入考试的时候都会往历史记录压一个空记录进去
    window.history.pushState("forward","进入考试","");
    // window.history.forward();
   $(function(){
      $(window).on("popstate", function(event) {
      //只要点击回退键就刷新页面   这个和上面的压入参数构成循环 达到禁止回退
          // alert("popstate");
          window.location.reload(true);
      });
   })

1. After the problem is refreshed, the parameters are lost.
Because the history record pushState is no longer the original address, it should be the address
of this page. 2. Use this principle to make crawler development more difficult.
We know that if the window.open method is unable to capture the packet on the current page, you can only go to the second page to refresh the page to capture the packet, unless the method is rewritten (make a breakpoint and use the console to rewrite the method or not execute this method, and execute the location directly .href). Then using the above method will result in not being able to catch the parameters,

Guess you like

Origin blog.csdn.net/qq_35189120/article/details/85070999