Widely available Supported across all major browsers. Safe to use in production.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
43
79
46
16
43
16

The Permissions interface of the Permissions API provides the core Permission API functionality, such as methods for querying and revoking permissions

43
79
46
16
43
16

The query() method of the Permissions interface returns the state of a user permission on the global scope.

43
79
46
16
43
16
request
Experimental
46
79
46

The PermissionStatus interface of the Permissions API provides the state of an object and an event handler for monitoring changes to said state.

43
79
46
16
43
16

The change event of the PermissionStatus interface fires whenever the PermissionStatus.state property changes.

43
79
46
16.4
43
16.4

The name read-only property of the PermissionStatus interface returns the name of a requested permission.

97
97
93
16
97
16

The state read-only property of the PermissionStatus interface returns the state of a requested permission. This property returns one of 'granted', 'denied', or 'prompt'.

44
79
46
16
44
16

The permissions read-only property of the WorkerNavigator interface returns a Permissions object that can be used to query and update permission status of APIs covered by the Permissions API.

43
79
133
16.4
43
16.4
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 1 item(s)
Experimental
  • Requires an experimental browser flag to be enabled
Notes 1 item(s)
Experimental
  • Requires an experimental browser flag to be enabled
Notes 1 item(s)
Experimental
  • Requires an experimental browser flag to be enabled
Notes 2 item(s)
Limitation
  • This browser only partially implements this feature
Implementation note
  • The `onchange` event handler is supported, but the event never fires. See bug 259432.
Notes 2 item(s)
Limitation
  • This browser only partially implements this feature
Implementation note
  • The `onchange` event handler is supported, but the event never fires. See bug 259432.
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (44)
Implementation note
  • Previously available under a different name: status (43)
Notes 2 item(s)
Removed
  • This feature was removed in a later browser version (44)
Implementation note
  • Previously available under a different name: status (43)

Syntax

JAVASCRIPT
navigator.permissions.query({ name: "geolocation" }).then((result) => {
  if (result.state === "granted") {
    showMap();
  } else if (result.state === "prompt") {
    showButtonToEnableMap();
  }
  // Don't do anything if the permission was denied.
});

Use cases

  • Using Permissions

    The permissions read-only property of the Navigator interface returns a

Cautions

  • May not be supported in older browsers.

Implementation notes

  • Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.