http 转hhttps

window.onload = function(){
    /*页面强转开始*/
    var tmpTag = 'https:' == document.location.protocol ? false : true;

    if(tmpTag){
        var urls=window.location.href;
        urls = urls.replace("http", "https");
        window.location=urls;
    }
    /*页面强转结束*/
}

  https 转http

window.onload = function(){
    /*页面强转开始*/
    var tmpTag = 'http:' == document.location.protocol ? false : true;

    if(tmpTag){
        var urls=window.location.href;
        urls = urls.replace("https", "http");
        window.location=urls;
    }
    /*页面强转结束*/
}
posted @ 2018-05-31 15:43  MAKE-IN-LEMON  阅读(1738)  评论(0编辑  收藏  举报