查找客户的大致物理位置
有没有办法用 Jquery 找到客户端的物理位置?我已经找到了如何获取他们的 IP 地址,并且如何使用 geoplugin 对他们的位置进行地理编码,但我想知道是否还有其他方法可以做到这一点?我不需要确切的位置。只需足够近似即可了解他们所处的状态,以便在进入实际状态之前估计税率。这可能吗?
Is there a way to find where a client is located physically with Jquery? I have found how to get their IP address, and also how to geocode their location with geoplugin, but I am wondering if there are other ways to do this? I don't need an exact location. Just approximate enough to know what state they are in to estimate a tax rate before they enter their actual state. Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 IP 地址进行地理定位(根据您已经在做的事情)是迄今为止最传统的方法 - 有一个新的 W3C 标准——但是它会提示人们获得许可(请参阅演示 此处),以及针对设备的如果没有嵌入式 GPS(例如 iPhone/Android),则必须利用服务器端服务进行 wifi 和/或 ip 地理定位——事实上,它会提示用户,这意味着它可能不适合您想要做的事情。
较大的网站将使用跟踪 cookie 来允许网站查找用户在之前访问时提供的数据 - 因此,如果您已经获得了客户之前访问时提供的送货地址,您可以使用他之前提供的邮政编码您的销售税估算。
Using IP address for geolocation (as per what you are already doing) is by far the most traditional way of doing it -- there are a new W3C standard -- however it will promp people for permission (see demo here), as well as it for devices without embedded GPS (e.g. iPhone/Android) will have to draw on server side services for wifi and/or ip geolocation -- the fact that it will propt users means that it is probably not suitable for what you want to do.
Bigger website will use a tracking cookie to allow the site to lookup data the user have provided at previous visits -- so if you already have the shipping address from a customer from a previous visit, you can use the zip code which he provided earlier for you sales-tax estimation.
http://www.maxmind.com/app/javascript_city
包含 JS 文件 http://j.maxmind.com/app/geoip.js &根据IP获取位置。
(它不是完全免费的,请参阅网站。)
http://www.maxmind.com/app/javascript_city
Include the JS file http://j.maxmind.com/app/geoip.js & get location based on IP.
(Its not completely free, see website.)