大佬教程收集整理的这篇文章主要介绍了html5 – 仍然支持google.loader.clientlocation,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
但是我测试中为null:
if (google.loader.ClientLOCATIOn)
这是谷歌没有找到IP信息的行为。
我搜索了StackOverflow,有很多问题,但没有很好的答案。
我在网上搜了一下,看到这两个链接:
> https://groups.google.com/forum/?fromgroups=#!topic/google-ajax-search-api/8q_oG-Y9fp8
> http://code.google.com/p/google-ajax-apis/issues/detail?id=586
> https://groups.google.com/forum/?fromgroups=#!topic/google-ajax-search-api/rzoIh4RrtOQ
应该使用哪个导航器HTML地理位置。
Google Api文档不再提及。
我想要确认Google google.loader.clientLOCATIOn是否仍然工作?
我的代码如下:
<html> <head> <script type="text/javascript" src="http://www.google.com/jsapi"></script> </head> <body> <script type="text/javascript"> function geotest() { if (google.loader.ClientLOCATIOn) { var latitude = google.loader.ClientLOCATIOn.latitude; var longitude = google.loader.ClientLOCATIOn.longitude; var city = google.loader.ClientLOCATIOn.address.city; var country = google.loader.ClientLOCATIOn.address.country; var country_code = google.loader.ClientLOCATIOn.address.country_code; var region = google.loader.ClientLOCATIOn.address.region; var text = 'Your LOCATIOn<br /><br />Latitude: ' + latitude + '<br />Longitude: ' + longitude + '<br />City: ' + city + '<br />Country: ' + country + '<br />Country Code: ' + country_code + '<br />Region: ' + region; } else { var text = 'Google was not able to detect your LOCATIOn'; } document.write(text); } geotest(); </script> </body> </html>
这是我从这里得到的答案:
> http://code.google.com/p/google-ajax-apis/issues/detail?id=586
所以当找不到IP的位置时,google.loader.ClientLOCATIOn为null
以上是大佬教程为你收集整理的html5 – 仍然支持google.loader.clientlocation全部内容,希望文章能够帮你解决html5 – 仍然支持google.loader.clientlocation所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。