页面初始加载的是默认刷新一次(f5)
生活随笔
收集整理的這篇文章主要介紹了
页面初始加载的是默认刷新一次(f5)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
參考找不到了,不好意思。。
兩種可以都試一下,解決問題就好了。
1.----------- <script type="text/javascript">window.onload = function(){var key = "pageDefaultRefreshOne";alert(getCookie(key));if(getCookie(key)==null){document.cookie=key+"=y";window.location.reload();}}function getCookie(name) { var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");if(arr=document.cookie.match(reg))return unescape(arr[2]); else return null; } </script>2.---------------- <script type="text/javascript">String.prototype.queryString= function(name) {var reg=new RegExp("[\?\&]" + name+ "=([^\&]+)","i"),r = this.match(reg);return r!==null?unescape(r[1]):null;};window.οnlοad=function(){var last=location.href.queryString("_v");if(location.href.indexOf("?")==-1){//alert("將刷新");location.href=location.href+"?_v="+(new Date().getTime());}else{var now=new Date().getTime();if(!last){//alert("將刷新");location.href=location.href+"&_v="+(new Date().getTime());}else if(parseInt(last)<(now-500)){//alert("將刷新");location.href=location.href.replace("_v="+last,"_v="+(new Date().getTime()));}}}; </script>
轉載于:https://www.cnblogs.com/moly/p/9682484.html
總結
以上是生活随笔為你收集整理的页面初始加载的是默认刷新一次(f5)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: kylin与superset整合
- 下一篇: 牛客小白月赛7 B 自杀游戏