PermissionStatus: state property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2022.

Note: This feature is available in Web Workers.

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'.

Value

One of the following:

'granted'

The user, or the user agent on the user's behalf, has given express permission to use a powerful feature. The caller can use the feature possibly without having the user agent ask the user's permission.

'denied'

The user, or the user agent on the user's behalf, has denied access to this powerful feature. The caller can't use the feature.

'prompt'

The user has not given express permission to use the feature (i.e., it's the same as denied). It also means that if a caller attempts to use the feature, the user agent will either be prompting the user for permission or access to the feature will be denied.

Examples

js
navigator.permissions
  .query({ name: "geolocation" })
  .then((permissionStatus) => {
    console.log(`geolocation permission state is ${permissionStatus.state}`);
    permissionStatus.onchange = () => {
      console.log(
        `geolocation permission status has changed to ${permissionStatus.state}`,
      );
    };
  });

Specifications

Specification
Permissions
# dom-permissionstatus-state

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
state
Chrome – No support
Chrome 43 – 43 (Release date: 2015-05-19)
altname
altname Alternate name: status
Chrome – Full support
Chrome 44 (Release date: 2015-07-21)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 46 (Release date: 2016-04-26)
footnote Full support
Opera – No support
Opera 30 – 30 (Release date: 2015-06-09)
altname
altname Alternate name: status
Opera – Full support
Opera 31 (Release date: 2015-08-04)
footnote Full support
Safari – Full support
Safari 16 (Release date: 2022-09-12)
footnote Full support
Chrome Android – No support
Chrome Android 43 – 43 (Release date: 2015-05-27)
altname
altname Alternate name: status
Chrome Android – Full support
Chrome Android 44 (Release date: 2015-07-29)
footnote Full support
Firefox for Android – Full support
Firefox for Android 46 (Release date: 2016-04-26)
footnote Full support
Opera Android – No support
Opera Android 30 – 30 (Release date: 2015-06-10)
altname
altname Alternate name: status
Opera Android – Full support
Opera Android 32 (Release date: 2015-09-23)
footnote Full support
Safari on iOS – Full support
Safari on iOS 16 (Release date: 2022-09-12)
footnote Full support
Samsung Internet – Full support
Samsung Internet 4 (Release date: 2016-03-11)
footnote Full support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – Full support
WebView on iOS 16 (Release date: 2022-09-12)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Uses a non-standard name
Has more compatibility info.