mo 1 年間 前
コミット
eeeebe23b5
1 ファイル変更83 行追加0 行削除
  1. 83 0
      index.html

+ 83 - 0
index.html

@@ -29,6 +29,89 @@
 </head>
 
 <body>
+  <script type="text/javascript">
+    function getChromeVersion() {
+      var arr = navigator.userAgent.split(' ');
+      var chromeVersion = '';
+      for (let i = 0; i < arr.length; i++) {
+        if (/chrome/i.test(arr[i])) chromeVersion = arr[i];
+      }
+      if (chromeVersion) {
+        return Number(chromeVersion.split('/')[1].split('.')[0]);
+      } else {
+        return false;
+      }
+    };
+
+
+    function isChrome() {
+      var isChromium = window.chrome;
+      var winNav = window.navigator;
+      var vendorName = winNav.vendor;
+      var isOpera = typeof window.opr !== 'undefined';
+      var isIEedge = winNav.userAgent.indexOf('Edge') > -1;
+      var isIOSChrome = winNav.userAgent.match('CriOS');
+      return (
+        isIOSChrome ||
+        (isChromium !== null &&
+          typeof isChromium !== 'undefined' &&
+          vendorName === 'Google Inc.' &&
+          isOpera === false &&
+          isIEedge === false)
+      );
+    };
+    function IEVersion() {
+      var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
+      var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器
+      var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器
+      var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
+      if (isIE) {
+        var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
+        reIE.test(userAgent);
+        var fIEVersion = parseFloat(RegExp["$1"]);
+        if (fIEVersion == 7) {
+          return 7;
+        } else if (fIEVersion == 8) {
+          return 8;
+        } else if (fIEVersion == 9) {
+          return 9;
+        } else if (fIEVersion == 10) {
+          return 10;
+        } else {
+          return 6;//IE版本<=7
+        }
+      } else if (isEdge) {
+        return 'edge';//edge
+      } else if (isIE11) {
+        return 11; //IE11
+      } else {
+        return -1;//不是ie浏览器
+      }
+    }
+    (function (window) {
+
+      if (IEVersion() != -1) {
+        var str = "你的浏览器版本太低了,请升级后重试 :(";
+        var str2 = "推荐使用:<a href='https://www.google.cn/intl/zh-CN/chrome/' target='_blank' style='color:blue;'>谷歌浏览器</a>,"
+          ;
+        document.writeln("<pre style='text-align:center;color:#fff;background-color:#0cc; height:100%;border:0;position:fixed;top:0;left:0;width:100%;z-index:1234'>" +
+          "<h2 style='padding-top:200px;margin:0'><strong>" + str + "<br/></strong></h2><h2>" +
+          str2 + "</h2>");
+        document.execCommand("Stop");
+      };
+      console.log(isChrome(), getChromeVersion())
+      if (isChrome() && getChromeVersion() < 87) {
+        var str = "你的浏览器版本太低了,请升级后重试 :(";
+        var str2 = "推荐使用:<a href='https://www.google.cn/intl/zh-CN/chrome/' target='_blank' style='color:blue;'>谷歌浏览器</a>,"
+          ;
+        document.writeln("<pre style='text-align:center;color:#fff;background-color:#0cc; height:100%;border:0;position:fixed;top:0;left:0;width:100%;z-index:1234'>" +
+          "<h2 style='padding-top:200px;margin:0'><strong>" + str + "<br/></strong></h2><h2>" +
+          str2 + "</h2>");
+        document.execCommand("Stop");
+      }
+
+    })(window);
+  </script>
   <div id="app"></div>
   <script type="module" src="/src/main.ts"></script>