JS实现页面强转https访问的设置方法

把如下js脚本代码放在页面头部即可

 <script type="text/javascript">
 var tmpTag = 'https:' == document.location.protocol ? false : true;
        if(tmpTag){
        var urls=window.location.href;
        urls = urls.replace("http://", "https://");
        window.location=urls;
        
 </script>


支付宝扫码打赏 微信扫码打赏

如果本文对你有帮助,欢迎打赏本站

喜欢 ()or分享
    匿名评论
  • 评论
人参与,条评论