JavaScript实现强制重定向至HTTPS页面

<script type="text/javascript">
var targetProtocol = "https:";
if (window.location.protocol != targetProtocol)
 window.location.href = targetProtocol +
  window.location.href.substring(window.location.protocol.length);
</script>


posted @ 2017-09-01 18:28  若水若鱼  阅读(538)  评论(0)    收藏  举报