HTML Intro

HTML Intro Quiz

HTML Intro Exercise

HTML Basics

HTML Basic Quiz

HTML Basic Exercise

HTML Advance

HTML Advance Quiz

HTML Advance Exercise

HTML Tags List

HTML Global Attributes

HTML Attributes


HTML5 Geolocation API

Geolocation API



In HTML5, the Geolocation API is used to obtain the user's geographical location. This can compromise user privacy, therefore, this option is not available unless the user approves it. However, Geolocation is much more accurate for devices with GPS, like smartphones.




Its main method is getCurrentPosition().


  • showLocation (mandatory): Defines the callback method that retrieves location information.
  • ErrorHandler(optional): Defines the callback method that is invoked when an error occurs in processing the asynchronous call.
  • Options (optional): Defines a set of options for retrieving the location information.


Presenting The Information:-


User location can be presented in two ways: Geodetic and Civic.

  • The geodetic way is to describe position refers directly to latitude and longitude.
  • The civic representation of location data is presented in a format that is more easily read and understood by the average person.

Code Explanation

All Tutorials related to HTML Advance

All Sections related to HTML