如何检测访问者的国家/地区?

发布于 2024-10-01 21:56:54 字数 564 浏览 4 评论 0原文

可能的重复:
IP 地址的位置检测技术

对于我们的网站来说,准确了解来自哪个 IP 地址非常重要我们的访客来自哪个国家。

我想我的问题的最佳答案是当前浏览器系统的简单地理位置功能,它只是询问用户是否允许网站查看他的地理位置:http://dev.w3.org/geo/api/spec-source.html

但我不想打扰访客带着问题,我希望自动检测访问者的位置(国家/地区就足够了)。

执行此操作的最佳方法是什么? - 哪个 IP 数据库最好? - 浏览器标头是否足够可信以检测他的国家/地区? (en-us en-en en-ca?) 最好的解决方案是什么?

Possible Duplicate:
Location detecting techniques for IP addresses

For our website it's important to know from exactly which country our visitor is coming from.

I guess the best answer for my question would be the simple geo location feature of current browser systems, which just ask the user if the website is allowed to see his geographic location: http://dev.w3.org/geo/api/spec-source.html

but I don't want to bother visitor with questions, I would love to automatically detects the visitor's location (country should be enough.)

What's the best way to do this?
- what ip database would be the best?
- is the browser header trustable enough to detect his country? (en-us en-en en-ca?)
What's the best solution?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

小糖芽 2024-10-08 21:56:54

NetImpact 提供一个免费的 API,用于通过 IP 进行地理位置查找,ProgrammableWeb 也有一个 GeoIP 查找提供商综述。当您的应用程序完成 API 调用时,这会产生少量延迟(除非您的应用程序可以使用非阻塞调用),但这是检测访问者原籍国的侵入性最小的方式。

NetImpact provide a free API for geolocation lookup by IP, ProgrammableWeb also has a roundup of GeoIP lookup providers. This involves a small amount of latency while your application completes an API call (unless your application can use a non-blocking call) but is the least intrusive manner of detecting a visitor's country of origin.

趁年轻赶紧闹 2024-10-08 21:56:54

浏览器标头只是告诉您用户想要查看的语言。去日本出差的讲西班牙语的人可能想查看西班牙语网站。

我认为您可以使用反向 IP 服务进行猜测,但如果是出于商业目的,我认为您必须要求用户告诉您。

与地理位置类似:计算机的物理位置可能与浏览网站的用户的需求相关,也可能不相关。

The browser header just tells you what language the user wants to see. A Spanish-speaking person on a business trip to Japan probably wants to see websites in Spanish.

I think you can use reverse-IP services to make a guess, but if it's for commerce purposes I think you have to ask the user to tell you.

Similarly with geo-location: the physical position of the computer may or may not be relevant to the needs of the user browsing the site.

若水微香 2024-10-08 21:56:54

http://www.iplocationtools.com/samples.html 还提供了一组很好的 api做这个。我以前用过他们的系统,非常可靠。

http://www.iplocationtools.com/samples.html also presents a good set of apis to do this. I have used their system before and they were quite reliable.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文