Skip to content

Commit a26077e

Browse files
committed
fix : 无法在Firefox正确跳转的问题
1 parent c29acc0 commit a26077e

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

index.html

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,22 @@
2828
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-P8BQTWL"
2929
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
3030
<!-- End Google Tag Manager (noscript) -->
31-
<script>
32-
var lang = navigator.language || navigator.userLanguage; if(lang.substr(0, 2) == "en") location = "https://dir.yuuta.moe/en/";
33-
else if(lang.substr(0, 2) == "zh") location = "https://dir.yuuta.moe/zh/";
34-
</script>
31+
<script type="text/javascript">
32+
  var type = navigator.appName;
33+
  if (type == "Netscape"){
34+
  var lang = navigator.language;//获取浏览器配置语言,支持非IE浏览器
35+
  }else{
36+
  var lang = navigator.userLanguage;//获取浏览器配置语言,支持IE5+ == navigator.systemLanguage
37+
  };
38+
  var lang = lang.substr(0, 2);//获取浏览器配置语言前两位
39+
  if (lang == "zh"){
40+
   window.location.replace('https://dir.yuuta.moe/zh/');//中文编码时打开链接
41+
  }else if (lang == "en"){
42+
   window.location.replace('https://dir.yuuta.moe/en/');
43+
  }else{//其他语言编码时打开以下链接
44+
   window.location.replace('https://dir.yuuta.moe/en/');
45+
  };
46+
</script>
3547

3648
</body>
3749

0 commit comments

Comments
 (0)