Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The autolocate property of the HTMLGeolocationElement interface gets and sets a boolean value indicating whether the browser should immediately request location data when the <geolocation> element is rendered, provided permission to use the geolocation feature is already granted.
It reflects the value of the <geolocation> autolocate attribute.
A boolean value:
true, location data is requested as soon as the <geolocation> element is rendered, provided permission to use the geolocation feature was previously granted.false, location data is only requested when the user presses the <geolocation> button.Defaults to false.
If permission to use the geolocation feature was not previously granted, the autolocate property is ignored.
<geolocation autolocate></geolocation>const geo = document.querySelector("geolocation");
console.log(geo.autolocate); // trueSee our Embedded map example walkthrough for a real-world example that includes autolocate.
<geolocation> element