IP to Location using Javascript

后端 未结 13 1401
死守一世寂寞
死守一世寂寞 2020-11-27 03:46




        
13条回答
  •  醉梦人生
    2020-11-27 04:12

    Either one of the following links should take care of this:

    http://ipinfodb.com/ip_location_api_json.php

    http://www.adam-mcfarland.net/2009/11/19/simple-ip-geolocation-using-javascript-and-the-google-ajax-search-api/

    Those links have tutorials for getting a users location through Javascript. However, they do so through an API to an external data service. If you have an extremely high traffic site, you might want to hosting the data yourself (or getting a premium api service). To host everything yourself, you will have to host a database with IP Geolocation and use ajax to feed the users location into Javascript. If this is the approach you want to take, you can get a free database of IP information below:

    http://www.ipinfodb.com/ip_database.php

    Please note that this method entails having to periodically update the database to stay accurate in tracing ips to locations.

提交回复
热议问题