Navigator.permissions.revoke is not a function
Asked Answered
P

1

6

I use HTML5 Geolocation to get user coordinates. But if the user does not agree to request access to GeoLocation, this will always be a problem when visiting the site.

I want to get access again when the user has been denied access.

I used the following:

https://developer.mozilla.org/en-US/docs/Web/API/Permissions/revoke

https://codelabs.developers.google.com/codelabs/permissions-introduction/index.html?index=..%2F..index#8

My code:

  function revokePermission() {
  navigator.permissions.revoke({name:'geolocation'}).then(function(result) {
    report(result.state);
  });
}

I get this error:

navigator.permissions.revoke is not a function

Thank you for helping

Placido answered 20/10, 2019 at 10:16 Comment(2)
check the Browser compatibility section in your first link - basically it works in Chrome, and in Firefox if you enable it ... no other browser has such a thingHeronry
Refer to the browser compatibility table developer.mozilla.org/en-US/docs/Web/API/Permissions/…Balikpapan
K
1

This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

MDN: https://developer.mozilla.org/en-US/docs/Web/API/Permissions/revoke#browser_compatibility

Katti answered 29/1, 2023 at 3:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.