navigator.permissions.query({ name: "geolocation" }).then((result) => {
if (result.state === "granted") {
showLocalNewsWithGeolocation();
} else if (result.state === "prompt") {
showButtonToEnableLocalNews();
}
// Don't do anything if the permission was denied.
});Permissions / notebook
Permissions
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.