如何在未经他许可的情况下获取网站访问者的经纬度? [英] how to get web visitors latitude and longitude without his permission?

查看:89
本文介绍了如何在未经他许可的情况下获取网站访问者的经纬度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个网络访问者经度和经度来标记谷歌地图上的点

?我已经实现了这个谷歌地图api.but它要求访问者许可,如何避免要求许可?或者是其他任何方法来实现这一目标?

I need a web visitors latitude and longitude to mark the point on google map
? I have achieved this google map api.but its asking visitors permission,how to avoid asking permission? or is any other way to achieve this?

推荐答案

这是一个浏览器问题,出于安全原因,您无法通过代码控制。
It's a browser issue and not something you can control via code for security reasons.


你最接近他们的位置而没有明确询问他们的位置数据是通过他们的IP地址 - 只有在家庭WiFi上才准确 - 3G / 4G IP地址不会给你任何准确的位置数据。



查看 Codehelper API [ ^ ] - 这是一个基于JS的库,事实上我在这里通过javascript问题回答某人的位置:根据IP地址查找用户位置无效 [< a href =http://www.codeproject.com/Answers/853635/find-user-loaction-based-on-ip-address-is-not-work#answer2target =_ blank> ^ ]



以下是它涉及的内容:

The closest you'd get to their location without explicitly asking for their location data is by their IP address - which will only be accurate if they are on a home WiFi - 3G/4G IP addresses will not give you any accurate location data.

Check out Codehelper API[^] - that is a JS based library and in-fact I answered someones location by javascript question here: find user location based on ip address is not working[^]

Here's what it involves:
<script src="http://www.codehelper.io/api/ips/?js"></script>
<script>
window.onload = function(){
    console.log(codehelper_ip);
};
</script>





返回JSON对象:



Which returns a JSON object:

{"IP":"149.215.142.9","ContinentCode":"EU","ContinentName":"Europe","CountryCode2":"GB","CountryCode3":"GBR","Country":"GB","CountryName":"United Kingdom","RegionName":"Unknown","CityName":"Unknown","CityLatitude":51.5,"CityLongitude":-0.13,"CountryLatitude":54,"CountryLongitude":-4.5,"LocalTimeZone":"Europe/London","REMOTE_ADDR":"149.215.142.9","HTTP_X_FORWARDED_FOR":"149.215.142.9","CallingCode":"44","Population":"61,113,205 (22)","AreaSqKm":"243,610 (80)","GDP_USD":"2.226 Trillion (7)","Capital":"London","Electrical":"230 V,50 Hz Type G","Languages":"English, Welsh (about 26% of the population of Wales), Scottish form of Gaelic (about 60,000 in Scotland)","Currency":"Pound Sterling (GBP)","Flag":"http://www.codehelper.io/api/ips/proips/flags/GB.jpg"}





我的建议是你可以使用它并仍然要求他们的纬度/长度 - 如果他们提供它然后很棒你得到一个更准确的位置 - 如果没有,你大致了解它们的位置。



My suggestion is that you could use this and still request their lat/long - if they provide it then great you get a more accurate location - if not, you get a general idea of where they are.


这篇关于如何在未经他许可的情况下获取网站访问者的经纬度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆