var reg = /^(192.168.1.)/;
    if(window.location.hostname !== 'localhost' && !reg.test(window.location.hostname)) {
      // 判断非本地server时 http强制转换成https
      var targetProtocol = "https:";
      if (window.location.protocol != targetProtocol)
      window.location.href = targetProtocol +
      window.location.href.substring(window.location.protocol.length);
    }

 

相关文章:

  • 2021-06-26
  • 2021-12-03
  • 2021-06-04
  • 2022-01-10
猜你喜欢
  • 2022-12-23
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
  • 2021-05-21
  • 2021-12-10
相关资源
相似解决方案