Tech blog to share information.

June 23, 2010

Geolocator : Visitor locator Application

June 23, 2010 Posted by tjcool No comments
Geolocation is the identification of the real-world geographic location of an object, such as a cell phone or an Internet-connected computer terminal. Here we strictly discussing abt internet and Ip addresses.Now days Ip address geocoding is very common or in simple way ip2location service.These services are very useful in many aspects like Geo (marketing),Fraud detection ,Censorship .and many more.
Now from here we will try to create a Visitor Locator Application.What will u need ?

1. Basic HTML knowledge
2. Offcourse internet connection
3. basic knowledge of java-script....

In later section we will discuss how to create same app with server side coding.....

First Step: Add Map & Script Referencs
After locating a visitor u need to show it on map.So what we need first a map where u can graphically show the position of IP address user. I prefer google map.As we dont have domain so what we will do?We will use the key of google,create HTML file and place following script in [B]head section.

Note :As we are looking for client side script so u can use this script
So it will look like this :

Step 2:
Now we just put all references of scripts Now its time to create Google map.

Step 3:
load map on page load and show visitor location.To so Follwing code is used

Complete code:

Thats it .....
Your Visitor locator is this code in any website.As soon as visitor vist site he will be located in Google map.Want to know something more about visitor you can use following script also.

document.write("Browser CodeName: " + navigator.appCodeName);

document.write("Browser Name: " + navigator.appName);

document.write("Browser Version: " + navigator.appVersion);

document.write("Cookies Enabled: " + navigator.cookieEnabled);

document.write("Platform: " + navigator.platform);

document.write("User-agent header: " + navigator.userAgent);