<geolocation></geolocation>HTMLGeolocationElement: permissionStatus property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const geo = document.querySelector("geolocation");
console.log(geo.permissionStatus);
// "prompt" if this is the first time the user has accessed this pagegeo.addEventListener("promptaction", notifyUserGrantPermission);function notifyUserGrantPermission() {
if (geo.permissionStatus === "denied" || geo.permissionStatus === "prompt") {
statusElem.textContent =
'Please press the "Use location" button again and allow location for this site.';
}
}