First introduce JavaScript API files
<script type= "Text/javascript" src= "Http://j.maxmind.com/app/geoip.js" ></script>
This API provides a total of 6 interfaces, Geoip_country_code () {Country Code},geoip_country_ name () {Country name},geoip_city () {city name},geoip_region () {Region code}, Geoip_latitude () {longitude},geoip_longitude () {latitude}.
Where the region code for Maxmind internal use of a code, the provincial provinces in accordance with the sequencer arranged by the number, by some means can be converted to administrative names.
Use instance:
Copy Code code as follows:
<meta http-equiv= "Content-type" cont Ent= "text/html; Charset=utf-8 "/>
<title>javascript api</title>
<script type=" Text/javascript "src=" /j.maxmind.com/app/geoip.js "></script>
<body>
<script type=" text/ JavaScript ">
var area =" ";
Try
{
if (geoip_city ()!= "" && geoip_city ()!= null)
Area + = geoip_city () + ",";
if (geoip_region_name ()!= "" && geoip_region_name ()!= null)
Area + = Geoip_region_name () + ",";
if (geoip_country_name ()!= "" && geoip_country_name ()!= null)
Area + = Geoip_country_name ();
}
catch (Err)
{
Area= "";
}
</script>
</body>