zoukankan      html  css  js  c++  java
  • 安卓微信浏览器location.reload()刷新无效

    function updateUrl(url,key){
            var key= (key || 't') +'=';  //默认是"t"
            var reg=new RegExp(key+'\d+');  //正则:t=1472286066028
            var timestamp=+new Date();
            if(url.indexOf(key)>-1){ //有时间戳,直接更新
                return url.replace(reg,key+timestamp);
            }else{  //没有时间戳,加上时间戳
                if(url.indexOf('?')>-1){
                    var urlArr=url.split('?');
                    if(urlArr[1]){
                        return urlArr[0]+'?'+key+timestamp+'&'+urlArr[1];
                    }else{
                        return urlArr[0]+'?'+key+timestamp;
                    }
                }else{
                    if(url.indexOf('#')>-1){
                        return url.split('#')[0]+'?'+key+timestamp+location.hash;
                    }else{
                        return url+'?'+key+timestamp;
                    }
                }
            }
        }




    window.location.href=updateUrl(window.location.href); //不传参,默认是“t”
    window.location.href=updateUrl(window.location.href,'v'); //传入自定义的变量名
  • 相关阅读:
    网口
    uart
    wwww
    ddr相关的配置经验
    嵌入式的指令集和寄存器
    协议栈
    《贝贝GO》服务条款
    《贝贝GO》隐私政策
    《贝贝GO》技术支持
    《王牌助理》隐私政策
  • 原文地址:https://www.cnblogs.com/chaser-li/p/9118774.html
Copyright © 2011-2022 走看看