index.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <link rel="icon" href="/favicon.ico" />
  6. <meta name="viewport"
  7. content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover">
  8. <meta http-equiv="Cache-control" content="no-cache">
  9. <meta http-equiv="Cache" content="no-cache">
  10. <meta name="apple-mobile-web-app-capable" content="yes" />
  11. <!-- 设置苹果工具栏颜色 -->
  12. <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  13. <!-- 忽略页面中的数字识别为电话,忽略email识别 -->
  14. <meta name="format-detection" content="telphone=no, email=no" />
  15. <!-- 启用360浏览器的极速模式(webkit) -->
  16. <meta name="renderer" content="webkit" />
  17. <!-- 避免IE使用兼容模式 -->
  18. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  19. <meta name="HandheldFriendly" content="true" />
  20. <!-- 设置在apple上以应用模式启动时,是否全屏 -->
  21. <meta name="apple-touch-fullscreen" content="yes" />
  22. <!-- windows phone 点击无高光 -->
  23. <meta name="msapplication-tap-highlight" content="no" />
  24. <meta name="referrer" content="no-referrer" />
  25. <title>老师端</title>
  26. </head>
  27. <body>
  28. <script type="text/javascript">
  29. function getChromeVersion() {
  30. var arr = navigator.userAgent.split(' ');
  31. var chromeVersion = '';
  32. for (let i = 0; i < arr.length; i++) {
  33. if (/chrome/i.test(arr[i])) chromeVersion = arr[i];
  34. }
  35. if (chromeVersion) {
  36. return Number(chromeVersion.split('/')[1].split('.')[0]);
  37. } else {
  38. return false;
  39. }
  40. };
  41. function isChrome() {
  42. var isChromium = window.chrome;
  43. var winNav = window.navigator;
  44. var vendorName = winNav.vendor;
  45. var isOpera = typeof window.opr !== 'undefined';
  46. var isIEedge = winNav.userAgent.indexOf('Edge') > -1;
  47. var isIOSChrome = winNav.userAgent.match('CriOS');
  48. return (
  49. isIOSChrome ||
  50. (isChromium !== null &&
  51. typeof isChromium !== 'undefined' &&
  52. vendorName === 'Google Inc.' &&
  53. isOpera === false &&
  54. isIEedge === false)
  55. );
  56. };
  57. function IEVersion() {
  58. var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
  59. var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器
  60. var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器
  61. var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
  62. if (isIE) {
  63. var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
  64. reIE.test(userAgent);
  65. var fIEVersion = parseFloat(RegExp["$1"]);
  66. if (fIEVersion == 7) {
  67. return 7;
  68. } else if (fIEVersion == 8) {
  69. return 8;
  70. } else if (fIEVersion == 9) {
  71. return 9;
  72. } else if (fIEVersion == 10) {
  73. return 10;
  74. } else {
  75. return 6;//IE版本<=7
  76. }
  77. } else if (isEdge) {
  78. return 'edge';//edge
  79. } else if (isIE11) {
  80. return 11; //IE11
  81. } else {
  82. return -1;//不是ie浏览器
  83. }
  84. }
  85. (function (window) {
  86. if (IEVersion() != -1) {
  87. var str = "你的浏览器版本太低了,请升级后重试 :(";
  88. var str2 = "推荐使用:<a href='https://www.google.cn/intl/zh-CN/chrome/' target='_blank' style='color:blue;'>谷歌浏览器</a>,"
  89. ;
  90. 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'>" +
  91. "<h2 style='padding-top:200px;margin:0'><strong>" + str + "<br/></strong></h2><h2>" +
  92. str2 + "</h2>");
  93. document.execCommand("Stop");
  94. };
  95. console.log(isChrome(), getChromeVersion())
  96. if (isChrome() && getChromeVersion() < 87) {
  97. var str = "你的浏览器版本太低了,请升级后重试 :(";
  98. var str2 = "推荐使用:<a href='https://www.google.cn/intl/zh-CN/chrome/' target='_blank' style='color:blue;'>谷歌浏览器</a>,"
  99. ;
  100. 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'>" +
  101. "<h2 style='padding-top:200px;margin:0'><strong>" + str + "<br/></strong></h2><h2>" +
  102. str2 + "</h2>");
  103. document.execCommand("Stop");
  104. }
  105. })(window);
  106. </script>
  107. <div id="app"></div>
  108. <script type="module" src="/src/main.ts"></script>
  109. </body>
  110. </html>