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>


原文地址:https://www.cnblogs.com/koala0521/p/7464604.html