jQuery offers a great way to find out where your website visitors geographic location. With a simple jQuery GeoLocation API call you find out your website viewers Country, Region & City. You can also find out thier Longitude and Latitude values to hook upto Google Maps to show where they are viewing from. The great news is that this service is completely free! :)
I’ve included an alert box to help you get it working, you should see something like this:
How to use jQuery GeoLocation:
- Copy the jQuery code below into the section of your webpage
- Copy the HTML code below into the section of your webpage
- Watch it’s magic!
It could be useful for registration forms which require the user to fill in thier location details, this is a form that I have auto populate form select dropdowns using jQuery GeoLocation method above:
You can view a live demo of this on signup form.
GeoLocation API Details
GeoPlugin offers the following features:
- Geo Location services
- Location Statistics
- Currency Converter
- Location codes, symbols & abbreviations
- Latitude/Longitude to place or post code
Geo Location services are available in the following formats and programming languages: