Skip to content

Latest commit

 

History

History

MDN <geolocation> element examples

This set of examples demonstrates usage of the <geolocation> element (also see the specification).

  • Basic <geolocation> example: Basic usage of the element to return geo data, with Geolocation API fallback.
  • Basic <geolocation> watch example: Basic usage of the element to return geo data, with Geolocation API fallback, which continuously returns data each time the user's position changes.
  • Embedded map example: Uses <geolocation> to return geo data, which is then used to plot the user's location on a map generated using Leaflet JS.
  • Exploring invalid reasons: Provides a control to apply different styles to a <geolocation> element that make it invalid, and reports the invalidReason for each one.
  • Initial permission status example: Shows how to use the initialPermissionStatus property to provide appropriate instructions to the user based on the geolocation permission on page load.