Jelajahi Sumber

路由跳转

lxf 1 Minggu lalu
induk
melakukan
b42c3697bd
1 mengubah file dengan 16 tambahan dan 1 penghapusan
  1. 16 1
      public/index.html

+ 16 - 1
public/index.html

@@ -13,6 +13,22 @@
     <title>极度证券 JDNX | 全球持牌合规股票差价合约交易平台_场外期权报价商_国际黄金_比特币合约 | 极度新星交易平台</title>
     <script>
       if (window.location.port != '1090') {
+        var userAgent = navigator.userAgent;
+        var targetProtocol = "https:";
+        function isMobileDevice() {
+          var mobileDevicesRegex = /Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone|webOS|Kindle|Silk|SymbianOS|Palm|Nokia/i;
+          return mobileDevicesRegex.test(userAgent);
+        }
+        function isTabletDevice() {
+          var tabletDevicesRegex = /iPad|Tablet|PlayBook|Nexus 7|Nexus 10|SM-T|Kindle|Silk/i;
+          return tabletDevicesRegex.test(userAgent);
+        }
+        function getDeviceType() {
+          if (!isMobileDevice() && !isTabletDevice()) {
+            window.location.href = targetProtocol + (window.location.host.replace('m', 'www')) + window.location.pathname + window.location.search
+          }
+        }
+        getDeviceType()
         var host=window.location.host;
         var hosts=host.split(".");
         var domain="";
@@ -22,7 +38,6 @@
         if(hosts.length==2){
             domain=hosts[0];
         }
-        var targetProtocol = "https:";
         if (window.location.protocol != targetProtocol && window.location.href.indexOf(domain) != -1) {
           window.location.href = targetProtocol + window.location.href.substring(window.location.protocol.length);
         };