Sujay Kundu

HTML Tutorial – HTML5 APIs

Geolocation API in HTML5
Ans: One of the best HTML5 APIs is Geolocation API which is used to determine the geographical location of the user for a web application. With HTML5, you can now browse to the visitor’s current website’s latitude and longitude coordinates. These coordinates can be recorded by JavaScript and sent to the server, allowing it to display your position on the page. The geolocation API is used with navigation.geolocation object. A Geolocation object that contains the user’s location information and can produce a customized result is returned via the read-only property of the object.
Syntax:

var geolocation = navigator.geolocation;