Aug 2, 2010
Get Current Location with MaxMind
Due to mobility , It is important to consider physical location in web products. Determining user's current location can make a application more relevant. Today in this blog post we will learn to detect user's current location, with help of MaxMind JavaScript Web Service.Idea
MaxMind Javascript Web Service is a service offered by MaxMind to return the Country, Region, City, Latitude, and Longitude for your web visitors.It uses Javascript and is very easy to program, works on both static and dynamically served web pages.
In order to use this Javascript on your website, a link back to the www.maxmind.com website should be provided, or a license can be purchased for $250/year.
Code
<script language="JavaScript" src="http://j.maxmind.com/app/geoip.js"></script>
<br>Country Code:
<script language="JavaScript">document.write(geoip_country_code());</script>
<br>Country Name:
<script language="JavaScript">document.write(geoip_country_name());</script>
<br>City:
<script language="JavaScript">document.write(geoip_city());</script>
<br>Latitude:
<script language="JavaScript">document.write(geoip_latitude());</script>
<br>Longitude:
<script language="JavaScript">document.write(geoip_longitude());</script>
Demo
You can see the working demo here.Related Articles
Play Sound onClick with JavaScript.Typographic Animation with Jquery
Top Programming Legends
Labels: Javascript, Tutorials, Web-service
By : Motyar+ @motyar