geolocation without requesting permission(未经许可的地理定位)
问题描述
我注意到现代基于 html5 的地理位置总是询问用户你想与这个网站分享你的位置吗?".这很好,但我知道还有其他途径可以尝试确定棒球场的地理位置,而无需请求此许可.如果我记得,这些服务使用 ip 数据库来尝试跟踪地理定位信息并将其提供给网络应用程序.
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 地理位置不太准确,但您不需要用户许可.http://ipinfo.io API(这是我的服务)使它变得非常简单.这是一个 jQuery 示例:
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");
此处提供更多详细信息.
这篇关于未经许可的地理定位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:未经许可的地理定位


基础教程推荐
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01