My Computer doesn’t have GPS but maps.google.com can mark my current location. Amazing!!!

My Computer doesn’t have GPS but maps.google.com can mark my current location. Amazing!!!

I found out this thing when I was seeing a contact webpage of a computer shop. Unintentionally, I clicked on “Get Direction” button and it asked for the permission to share my location information with the maps.google.com, I grant it then Google maps showed my current location with the difference of 15 to 20 feet as normally seen in GPS devices. I opened the guide of my laptop and searched about GPS or other location sensor device but didn’t find anything related to this topic. I went to my old PC and try this thing and it gives me the same location. This thing was amazing to me. A simple idea came to my mind that it would probably be a topic of IP Addressing but how? This question is very important. I tried this on Firefox too. Firefox asked for permission and there was also a link about geolocation http://www.mozilla.org/en-US/firefox/geolocation/. I went through it and find that my simple idea was right.
Firefox geolocation guide says about its working,
“Firefox gathers information about nearby wireless access points and your computer’s IP address. Then Firefox sends this information to the default geolocation service provider, Google Location Services, to get an estimate of your location. That location estimate is then shared with the requesting website.”

The most important thing for consideration is that if we are tracking by unauthorized parties? so, the answer is “NO” as stated in the guide,

“Firefox only requests a location when a website makes a request, and only shares your location when the user has approved the request. Firefox does not track or remember your location as you browse.”

Read this link for more information http://www.mozilla.org/en-US/firefox/geolocation/.

Now, Let’s play with a javascript code,
In Google Chrome, press Crtl + J and enter this code in console. It will ask for permission and display you an object in console with your longitude and latitude.

navigator.geolocation.getCurrentPosition(function(position){
console.log(position);
});

You can use this in your web applications to implement functionalities related to geolocation.
Read this link for more information about the working http://compnetworking.about.com/od/traceipaddresses/f/ip_location.htm.