不基于 IP 识别用户位置

发布于 2024-10-31 04:03:25 字数 111 浏览 6 评论 0原文

我知道如何使用 IP 号码确定用户的位置。但是,我想知道是否有一些更精确的技术。我见过一些应用程序,例如。谷歌地图正在请求用户许可以获取他的位置。有某种这样的API吗?我错过了什么吗?

多谢!

I know how can I determine user's location using IP number. However, I'm wondering if there is some more precise technique. I've seen that some applications, eg. Google MAPS, are asking a user for permission to get his location. Is there some kind of such API? Am I missing something?

Thanks a lot!

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

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

发布评论

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

评论(5

草莓味的萝莉 2024-11-07 04:03:25

据我所知,唯一普遍可用、更准确的方法是 HTML 5 地理定位 API。该 API 有时可以通过扫描附近的无线网络及其 ID,或查询连接到计算机的 GPS 设备(或如 @Pascal 所说,内置于 iPhone 等移动设备中的 GPS 设备)来获取更准确的位置。

然而,只有当计算机具有正确的硬件并且需要用户的明确同意时,这才有效。

对于无需用户同意的服务器端地理定位,基于 IP 的方法仍然是最好的方法。

请参阅此问题,了解其工作原理的详细说明:关于 HTML 5 中的地理定位

The only generally available, more exact method known to me is the HTML 5 geolocation API. That API can sometimes fetch a more exact location by scanning nearby wireless networks and their IDs, or querying a GPS device attached to the computer (or as @Pascal says, a GPS device built into a mobile device like an iPhone).

This however works only if the computer has the right hardware, and requires explicit consent from the user.

For user-consent-free, server-side geolocation, the IP-based method is still the best you can do.

See this question for a great rundown on how it works: About Geolocation in HTML 5

把回忆走一遍 2024-11-07 04:03:25

有些设备(通常是智能手机)有 GPS - 这意味着非常精确的位置 - 或者可以使用 wifi / 手机信号塔 / ...

您无法在服务器上获取该位置(它不会发送给您 )通过浏览器),但您可以从 Javascript 获取它(然后使用一些 Ajax 将其发送到服务器)。

对于一些文档,您可以查看:

Some devices (typically, smartphones) have a GPS -- which means quite precise location -- or can use wifi / cell-towers / ...

You cannot get that location on the server (it's not sent by the browser), but you could get it from Javascript (and, then, send it to the server, using some Ajax).

For some documentation, you can take a look at :

你怎么这么可爱啊 2024-11-07 04:03:25

HTML5 中的地理定位似乎存在问题 http://ipgeo5.com/

昨天我在蒙特利尔,完美地定位了我的位置当前位置精确到 30 英尺(估计值)。运行 Windows XP、Chrome 14.0.835。

今天,我在加拿大安大略省一个小镇我妈妈的家里,遇到了这个错误。


您当前的位置
我们估计您位于
注意:未定义的属性:stdClass::$AdministrativeArea in /var/www/ipgeo5.com/pages/city.php on line 29

注意:尝试获取/var/www/ipgeo5.com/pages/中非对象的属性city.php 第 29 行
, , 加拿大使用 HTML 5 地理定位技术。
您的位置:

注意:未定义的属性:stdClass::$AdministrativeArea in /var/www/ipgeo5.com/pages/city.php on line 29

注意:尝试获取 /var/www/ipgeo5.com 中非对象的属性/pages/city.php on line 29

, , Canada

所以我猜这不是 100% 有效!

因此需要有使用 IP2Location 数据库来识别位置的 B 计划。

谢谢 !

米歇尔, 蒙特利尔, 加拿大

Seems to be problems with GeoLocation in HTML5 http://ipgeo5.com/

Yesterday I was in Montreal and worked perfectly pinpointing my current location to the nearest 30 feet(estimate). Running Windows XP, Chrome 14.0.835.

Today, I am at my mom's house in a small town in Ontario, Canada and getting this error.


Your Current Location
We have estimated you are located at
Notice: Undefined property: stdClass::$AdministrativeArea in /var/www/ipgeo5.com/pages/city.php on line 29

Notice: Trying to get property of non-object in /var/www/ipgeo5.com/pages/city.php on line 29
, , Canada by using HTML 5 Geolocation technique.
Your location:

Notice: Undefined property: stdClass::$AdministrativeArea in /var/www/ipgeo5.com/pages/city.php on line 29

Notice: Trying to get property of non-object in /var/www/ipgeo5.com/pages/city.php on line 29

, , Canada

So I guess this is not 100% effective !

So needs to have Plan B using IP2Location database to identify location.

Thanks !

Michel, Montreal, Canada

带刺的爱情 2024-11-07 04:03:25

这就是地理定位 API

That would be the geolocation API.

阿楠 2024-11-07 04:03:25

See the Geolocation API and the matching section of Dive into HTML 5

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