Need a client side API for determing geo location of IP addresses

China☆狼群 提交于 2019-11-27 14:53:11

I was looking at these guys a couple months ago: http://www.maxmind.com/app/geolitecountry

It seemed OK, for my limited purposes.

a quick google search yielded this result: http://www.hostip.info/dl/index.html

I think it is what you are looking for.

For a web based one you can use: http://code.google.com/apis/ajaxsearch/. All you do is have:

<script type="text/javascript" src="http://www.google.com/jsapi?key=yourapikey"></script>

and now Google populates some javascript variables and in your other js scripts you can now access geographic location using: google.loader.ClientLocation.address.city, google.loader.ClientLocation.address.region, google.loader.ClientLocation.address.country.

For a very rough and local solution you can get the IP ranges of countries here: http://www.countryipblocks.net/continents/. You can basically store this locally and reference it to get a rough geographic location.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!