This javascript API enables you to produce a more dynamic and user-friendly web browsing experience. For example, you can display a custom content depending on visitor IP location. This API returns you more than just the country, region and city name, but also the coordinate, ZIP code, time zone, ISP, domain name, IDD code, area code and weather station information. This javascript API is FREE, and you will be given 1,000 credits upon the sign up. Please note that each query will consume 1 credit. If you need more credits, you can embed the IPLocationTools Banner to replenish it.

Below is the syntax of the Javascript API.

Functions Description

Function Description Sample Output
ip2location_country_flag(); Return country flag
ip2location_country_short(); Return country name (short)
ip2location_country_long(); Return country name (long)
ip2location_region(); Return region
ip2location_city(); Return city
ip2location_latitude(); Return latitude
ip2location_longitude(); Return longitude
ip2location_zip_code(); Return ZIP code
ip2location_time_zone(); Return time zone
ip2location_isp(); Return ISP
ip2location_domain(); Return domain
ip2location_net_speed(); Return net speed
ip2location_idd_code(); Return IDD code
ip2location_area_code(); Return area code
ip2location_weather_station_code(); Return weather station code
ip2location_weather_station_name(); Return weather station name

Examples

Result

Result

Result

Result

IP2Location

IP2Location Free Widget

IP2Location Firefox Add-on