【发布时间】:2014-09-19 13:15:07
【问题描述】:
我们的 .co.uk 网站可以正常运行,我们刚刚购买了 .london 域名。我们想做的是根据用户点击时的实际位置将用户重定向到 .london 网站。
是否有一段代码可以检测最近的网络服务器并使用该信息来决定是发送到 .co.uk 还是 .London?
【问题讨论】:
标签: javascript html geolocation
我们的 .co.uk 网站可以正常运行,我们刚刚购买了 .london 域名。我们想做的是根据用户点击时的实际位置将用户重定向到 .london 网站。
是否有一段代码可以检测最近的网络服务器并使用该信息来决定是发送到 .co.uk 还是 .London?
【问题讨论】:
标签: javascript html geolocation
您可以使用geobytes 之类的服务来检测位置并根据它进行重定向。
网址是:
https://secure.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress=x.x.x.x&pt_email=someone@example.com&pt_password=xxxxxxxxxx
【讨论】:
只是为了任何偶然发现此答案的人的利益而进行的更新... Geobytes 现在已经发布了一个新的 API 来替换之前答案中提到的那个。新的 API 是这样调用的,其中 x.x.x.x 是 IP 地址:
http://getcitydetails.geobytes.com/GetCityDetails?fqcn=x.x.x.x
这里有更多信息:http://www.geobytes.com/get-city-details-api/
更好的是,使用我们的 GeoDirection 服务可能更容易 - http://www.geobytes.com/geodirection/
【讨论】: