1 <input type="hidden" id="history_back" />   
 2 <script>
 3         (function() {
 4             var historyBack = document.getElementById('history_back')
 5             var val = historyBack.value;
 6 
 7             if (val) {
 8           
 9                 setTimeout(function() {
10          
11                     //alert('即将刷新页面');
12                     // window.location.reload(); //重新加载
13                     //window.history.go(-1);//返回上一层
14                 }, 200);
15             } else {
16                 historyBack.value = 'history';
17             }
18             ;
19         }());
20     </script>

 

//原理:第一次进入页面的时候id为history_back的标签为空,会执行第15行的方法为history_back赋值,当页面由下一页返回的时候history_back已经有了值,所以就会跳到第7行的方法里面执行里面的方法

相关文章:

  • 2021-06-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2021-07-20
  • 2022-01-11
猜你喜欢
  • 2022-12-23
  • 2021-07-28
  • 2021-12-19
  • 2021-06-21
  • 2021-10-22
  • 2021-12-17
  • 2022-12-23
相关资源
相似解决方案