根据IP国家(Geo-IP)进行重定向

问题描述 投票:0回答:1

此代码在运行时显示页面,然后将其重定向。我希望它能够快速重定向,但不是。

我在哪里创建应用程序blogspot.com

<script>
  fetch('https://freegeoip.app/json/')
  .then(function(response) {
    return response.json();
  })
  .then(function(data) {
    if(data.country_code == 'TR') {
      window.location.replace("https://www.google.com");
    }
  })
</script>
javascript php geoip
1个回答
0
投票

1。具有浏览器语言的JavaScript解决方案(无延迟)

© www.soinside.com 2019 - 2024. All rights reserved.