Permissions

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

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

Methods

Permissions.query()
Returns the user permission status for a given API.
Permissions.request()
Requests permission to use a given API. This is not currently supported in any browser.
Permissions.requestAll()
Requests permission to use a given set of APIs. This is not currently supported in any browser.
Permissions.revoke()
Revokes the permission currently set on a given API.

Example

navigator.permissions.query({name:'geolocation'}).then(function(result) {
  if (result.state === 'granted') {
    showLocalNewsWithGeolocation();
  } else if (result.state === 'prompt') {
    showButtonToEnableLocalNews();
  }
  // Don't do anything if the permission was denied.
});

Specification

Specification Status Comment
Permissions
The definition of 'Permissions' in that specification.
Working Draft Initial definition.

Browser Support

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
PermissionsChrome Full support 43Edge Full support 79Firefox Full support 46IE No support NoOpera Full support YesSafari No support NoWebView Android Full support 43Chrome Android Full support 43Firefox Android Full support 46Opera Android Full support YesSafari iOS No support NoSamsung Internet Android Full support 4.0
accelerometer permissonChrome Full support 62Edge Full support 79Firefox ? IE No support NoOpera ? Safari No support NoWebView Android Full support 62Chrome Android Full support 62Firefox Android ? Opera Android ? Safari iOS No support NoSamsung Internet Android Full support 8.0
accessibility-events events permissonChrome Full support 62Edge Full support 79Firefox ? IE No support NoOpera ? Safari No support NoWebView Android Full support 62Chrome Android Full support 62Firefox Android ? Opera Android ? Safari iOS No support NoSamsung Internet Android Full support 8.0
ambient-light-sensor permissonChrome Full support 62Edge Full support 79Firefox ? IE No support NoOpera ? Safari No support NoWebView Android Full support 62Chrome Android Full support 62Firefox Android ? Opera Android ? Safari iOS No support NoSamsung Internet Android Full support 8.0
background-sync permissonChrome Full support 62Edge Full support 79Firefox ? IE No support NoOpera ? Safari No support NoWebView Android Full support 62Chrome Android Full support 62Firefox Android ? Opera Android ? Safari iOS No support NoSamsung Internet Android Full support 8.0
camera permissionChrome Full support 64Edge Full support 79Firefox ? IE No support NoOpera ? Safari No support NoWebView Android Full support 64Chrome Android Full support 64Firefox Android ? Opera Android ? Safari iOS No support NoSamsung Internet Android Full support 9.0
clipboard-read permissonChrome Full support 64Edge Full support 79Firefox No support NoIE No support NoOpera ? Safari No support NoWebView Android Full support 64Chrome Android Full support 64Firefox Android No support NoOpera Android ? Safari iOS No support NoSamsung Internet Android Full support 9.0
clipboard-write permissionChrome Full support 64Edge Full support 79Firefox No support NoIE No support NoOpera ? Safari No support NoWebView Android Full support 64Chrome Android Full support 64Firefox Android No support NoOpera Android ? Safari iOS No support NoSamsung Internet Android Full support 9.0
geolocation permissionChrome Full support 43Edge Full support 79Firefox ? IE No support NoOpera Full support 30Safari No support NoWebView Android No support NoChrome Android Full support 43Firefox Android ? Opera Android Full support 30Safari iOS No support NoSamsung Internet Android Full support 4.0
gyroscope permissionChrome Full support 51Edge Full support 79Firefox ? IE No support NoOpera ? Safari No support NoWebView Android Full support 51Chrome Android Full support 51Firefox Android ? Opera Android ? Safari iOS No support NoSamsung Internet Android Full support 5.0
magnetometer permissionChrome Full support 62Edge Full support 79Firefox ? IE No support NoOpera ? Safari No support NoWebView Android Full support 62Chrome Android Full support 62Firefox Android ? Opera Android ? Safari iOS No support NoSamsung Internet Android Full support 8.0
microphone permissionChrome Full support 64Edge Full support 79Firefox ? IE No support NoOpera ? Safari No support NoWebView Android Full support 64Chrome Android Full support 64Firefox Android ? Opera Android ? Safari iOS No support NoSamsung Internet Android Full support 9.0
midi permissionChrome Full support 43Edge Full support 79Firefox ? IE No support NoOpera Full support 30Safari No support NoWebView Android No support NoChrome Android Full support 43Firefox Android ? Opera Android Full support 30Safari iOS No support NoSamsung Internet Android Full support 4.0
notifications permissionChrome Full support 43Edge Full support 79Firefox ? IE No support NoOpera Full support 30Safari No support NoWebView Android No support NoChrome Android Full support 43Firefox Android ? Opera Android Full support 30Safari iOS No support NoSamsung Internet Android Full support 4.0
payment-handler permissionChrome Full support 66Edge Full support 79Firefox ? IE No support NoOpera ? Safari No support NoWebView Android Full support 66Chrome Android Full support 66Firefox Android ? Opera Android ? Safari iOS No support NoSamsung Internet Android Full support 9.0
persistent-storage permissionChrome Full support 71Edge Full support 79Firefox Full support 53IE No support NoOpera Full support 58Safari No support NoWebView Android Full support 71Chrome Android Full support 71Firefox Android Full support 53Opera Android Full support 50Safari iOS No support NoSamsung Internet Android Full support 10.0
push permissionChrome Full support 43Edge Full support 79Firefox ? IE No support NoOpera Full support 30Safari No support NoWebView Android No support NoChrome Android Full support 43Firefox Android ? Opera Android Full support 30Safari iOS No support NoSamsung Internet Android Full support 4.0
queryChrome Full support 43Edge Full support 79Firefox Full support 46IE No support NoOpera Full support YesSafari No support NoWebView Android Full support 43Chrome Android Full support 43Firefox Android Full support 46Opera Android Full support YesSafari iOS No support NoSamsung Internet Android Full support 4.0
request
ExperimentalNon-standard
Chrome Full support 46Edge Full support 79Firefox No support NoIE No support NoOpera ? Safari No support NoWebView Android Full support 46Chrome Android Full support 46Firefox Android No support NoOpera Android ? Safari iOS No support NoSamsung Internet Android Full support 5.0
requestAll
ExperimentalNon-standard
Chrome Full support 48Edge Full support 79Firefox No support NoIE No support NoOpera ? Safari No support NoWebView Android Full support 48Chrome Android Full support 48Firefox Android No support NoOpera Android ? Safari iOS No support NoSamsung Internet Android Full support 5.0
revoke
ExperimentalNon-standard
Chrome Full support 46Edge Full support 79Firefox Full support 51
Disabled
Full support 51
Disabled
Disabled From version 51: this feature is behind the dom.permissions.revoke.enable preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No support 47 — 51
IE No support NoOpera ? Safari No support NoWebView Android Full support 46Chrome Android Full support 46Firefox Android Full support 51
Disabled
Full support 51
Disabled
Disabled From version 51: this feature is behind the dom.permissions.revoke.enable preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No support 47 — 51
Opera Android ? Safari iOS No support NoSamsung Internet Android Full support 5.0

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.
User must explicitly enable this feature.
User must explicitly enable this feature.