geo.addEventListener("validationstatuschange", () => {
if (geo.isValid) {
reasonElem.textContent = `<geolocation> is valid`;
} else {
reasonElem.textContent = `Invalid reason: ${geo.invalidReason}`;
}
});HTMLGeolocationElement: validationstatuschange event
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.