Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The HTMLGeolocationElement() constructor creates a new HTMLGeolocationElement object instance.
new HTMLGeolocationElement()None.
A new HTMLGeolocationElement object instance, if used internally by the browser.
Developers cannot use the HTMLGeolocationElement() constructor directly to create a new HTMLGeolocationElement instance: attempting to do so results in an "illegal constructor" error.
HTMLGeolocationElement instance programmaticallyTo programmatically create a new HTMLGeolocationElement instance, instead of trying to use the constructor directly, you would create a new <geolocation> element instance using Document.createElement():
const geo = document.createElement("geolocation");You can then use it by appending it to the DOM:
document.body.append(geo);<geolocation> element