google.loader.ClientLocation使用IP地址获取某人的lat/long
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了google.loader.ClientLocation使用IP地址获取某人的lat/long相关的知识,希望对你有一定的参考价值。
Set the center of the map on the person's location based on IP address. In this case the user is required to be in the USA.
if (GBrowserIsCompatible()) { var map = new google.maps.Map2(document.getElementById("my-googlemap")); if (google.loader.ClientLocation && google.loader.ClientLocation.address.country_code == "US" && google.loader.ClientLocation.address.region) { // geo locate was successful and user is in the states map.setCenter( new google.maps.LatLng(google.loader.ClientLocation.latitude, google.loader.ClientLocation.longitude ), 8 ); // do the rest of your map stuff here } }
以上是关于google.loader.ClientLocation使用IP地址获取某人的lat/long的主要内容,如果未能解决你的问题,请参考以下文章