问题描述
我注意到现代基于HTML5的地理定位总是要求用户你想与这个网站分享你的位置吗?。这很好,但我知道还有其他途径试图确定一个球场地理位置,而无需申请此许可。如果我记得,这些服务使用IP数据库来尝试跟踪地理信息并将其提供给Web应用程序。
因此,在我的网站中,我希望在用户的邮政编码上得到最佳猜测,而不需要请求地理位置权限。这是什么做的?
IP地理定位不够精确,但你并不需要用户的简单和/或最好的方法许可。 API(这是我的服务)使其非常简单。下面是一个jQuery示例:
$ $ $ $ get(http://ipinfo.io,function(response){
console.log(response.city,response.region,response.country);
},jsonp);
更多详情可在。
Ive noticed that modern html5 based geolocation always asks the user "do you want to share your location with this website?". Which is fine, but I know there are other routes of trying to determine a ballpark geolocation without having to request this permission. If I recall, these services uses ip databases to try to track geolocaiton info and provide it to a web app.
So, in my website I would like to get a "best guess" at the user's zip code, without the geolocation permission being requested. What's the simplest and/or best method of doing this?
IP geolocation is less accurate, but you don't need user permission for it. The http://ipinfo.io API (which is my service) makes it extremely simple. Here's a jQuery example:
$.get("http://ipinfo.io", function(response) {
console.log(response.city, response.region, response.country);
}, "jsonp");
More details are available here.
这篇关于没有请求许可的地理定位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!