Wireless Geolocation (HTML 5 Geolocation API) vs. IP Geolocation
It is good that with the introduction of HTML 5, there is now a specification for a Geolocation API. Geolocation is the technology of figuring out where you are in the world. There are many ways to figure out where you are — your IP address, your wireless network connection, which cell tower your phone is talking to, or dedicated GPS hardware that receives latitude and longitude information from satellites in the sky. This article aims to show you what are the things you can do with this new API controlled by web browser client based on wireless geolocation and compare it with the server-side IP geolocation.
Using the traditional Geolocation via IP address
The traditional way of doing Geolocation via IP address using IP2Location’s database is the server-side code will check the detected user IP address against the IP2Location database.
Using the new HTML 5 Geolocation API which checks your network adapter’s MAC address
Now compare it with Geolocation API which is using the Javascript code below. Your web browser must support HTML 5 and you need to grant permission to collect geolocation data.
<div id="GeoAPI"></div> <script language="Javascript"> if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { doStuff(position.coords.latitude, position.coords.longitude); }); } else { if (document.getElementById("GeoAPI")) { document.getElementById("GeoAPI").innerHTML = "I'm sorry but geolocation services are not supported by your browser"; document.getElementById("GeoAPI").style.color = "#FF0000"; } } function doStuff(mylat, mylong) { if (document.getElementById("GeoAPI")) { document.getElementById("GeoAPI").innerHTML = "<iframe style=\"width: 400px; height: 400px\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" src=\"//maps.google.com/?ll=" + mylat + "," + mylong + "&z=16&output=embed\"></iframe>"; } } </script>
Comparison
Wireless Geolocation | IP Address Geolocation | |
Technology | MAC Address and Signal Strength | IP Address |
Accuracy | Medium-High (Street level) | Medium (City level) |
Availability | Medium (Depends to Data) | High |
Privacy | Low | Medium |
End-user Permission | Required | No |
Browser Compatibility | HTML 5 and above | All |
Sample applications using HTML 5 Geolocation
- Find points of interest in the user’s area
- Annotating content with location information
- Show the user’s position on a map
- Turn-by-turn route navigation
- Alerts when points of interest are in the user’s vicinity
- Up-to-date local information
- Location-tagged status updates in social networking applications
Sample applications using IP address Geolocation
- Display native language and currency
- Redirect web pages based on geographical
- Digital Rights Management
- Prevent password sharing and abuse of service
- Reduce credit card fraud
- Web log statistics and analysis
- Auto-selection of country on forms
- Filter access from countries you do not do business with
- Geo-targeting for increased sales and click-through
- Spam filtering by location
Conclusion
As you can see, the location detected for the HTML 5 Geolocation API could be more accurate when it is actually able to detect your location. Currently, it may not be able to detect all locations yet and not all browsers at present support this Geolocation API.
There is also a privacy issue so you will need to agree to share your current location with the geodata provider, which is currently Google, to be able to utilize this functionality.
On the other hand, the traditional method of Geolocation which checks your IP address is less intrusive at the cost of being less accurate when it comes to dynamic IP addresses.
However, for most developers, it is usually sufficient for their daily needs. IP Geolocation would be the preferred choice of developers who wish to shield their users from having their privacy intruded upon.
THE POWER OF IP GEOLOCATION
Find a solution that fits.