The Permissions API provides a consistent programmatic way to query the status of API permissions attributed to the current context. For example, the Permissions API can be used to determine if permission to access a particular API has been granted or denied.
Concepts and usage
Historically different APIs handle their own permissions inconsistently — for example the Notifications API allows for explicit checking of permission status and requesting permission, whereas the Geolocation API doesn't (which causes problems if the user denied the initial permission request). The Permissions API provides the tools to allow developers to implement a better user experience as far as permissions are concerned.
The permissions
property has been made available on the Navigator
object, both in the standard browsing context and the worker context (WorkerNavigator
— so permission checks are available inside workers), and returns a Permissions
object that provides access to the Permissions API functionality.
Once you have this object you can then perform permission-related tasks, for example querying a permission using the Permissions.query()
method to return a promise that resolves with the PermissionStatus
for a specific API.
Not all APIs' permission statuses can be queried using the Permissions API. Notable APIs that are Permissions-aware include:
- Clipboard API
- Notifications API
- Push API
- Web MIDI API
More APIs will gain Permissions API support over time.
Examples
We have made a simple example available called Location Finder. You can run the example live, or view the source code on Github.
Read more about how it works in our article Using the Permissions API.
Interfaces
Navigator.permissions
andWorkerNavigator.permissions
Read only- Provides access to the
Permissions
object from the main context and worker context respectively. Permissions
- Provides the core Permission API functionality, such as methods for querying and revoking permissions.
PermissionStatus
- Provides access to the current status of a permission, and an event handler to respond to changes in permission status.
Specification
Specification | Status | Comment |
---|---|---|
Permissions | Working Draft | Initial definition. |
Browser compatibility
Permissions interface
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Permissions | Chrome Full support 43 | Edge Full support 79 | Firefox Full support 46 | IE No support No | Opera Full support Yes | Safari No support No | WebView Android Full support 43 | Chrome Android Full support 43 | Firefox Android Full support 46 | Opera Android Full support Yes | Safari iOS No support No | Samsung Internet Android Full support 4.0 |
accelerometer permission | Chrome Full support 62 | Edge Full support 79 | Firefox ? | IE No support No | Opera ? | Safari No support No | WebView Android Full support 62 | Chrome Android Full support 62 | Firefox Android ? | Opera Android ? | Safari iOS No support No | Samsung Internet Android Full support 8.0 |
accessibility-events permission | Chrome Full support 62 | Edge Full support 79 | Firefox ? | IE No support No | Opera ? | Safari No support No | WebView Android Full support 62 | Chrome Android Full support 62 | Firefox Android ? | Opera Android ? | Safari iOS No support No | Samsung Internet Android Full support 8.0 |
ambient-light-sensor permission | Chrome Full support 62 | Edge Full support 79 | Firefox ? | IE No support No | Opera ? | Safari No support No | WebView Android Full support 62 | Chrome Android Full support 62 | Firefox Android ? | Opera Android ? | Safari iOS No support No | Samsung Internet Android Full support 8.0 |
background-sync permission | Chrome Full support 62 | Edge Full support 79 | Firefox ? | IE No support No | Opera ? | Safari No support No | WebView Android Full support 62 | Chrome Android Full support 62 | Firefox Android ? | Opera Android ? | Safari iOS No support No | Samsung Internet Android Full support 8.0 |
camera permission | Chrome Full support 64 | Edge Full support 79 | Firefox ? | IE No support No | Opera ? | Safari No support No | WebView Android Full support 64 | Chrome Android Full support 64 | Firefox Android ? | Opera Android ? | Safari iOS No support No | Samsung Internet Android Full support 9.0 |
clipboard-read permission | Chrome Full support 64 | Edge Full support 79 | Firefox No support No | IE No support No | Opera ? | Safari No support No | WebView Android Full support 64 | Chrome Android Full support 64 | Firefox Android No support No | Opera Android ? | Safari iOS No support No | Samsung Internet Android Full support 9.0 |
clipboard-write permission | Chrome Full support 64 | Edge Full support 79 | Firefox No support No | IE No support No | Opera ? | Safari No support No | WebView Android Full support 64 | Chrome Android Full support 64 | Firefox Android No support No | Opera Android ? | Safari iOS No support No | Samsung Internet Android Full support 9.0 |
geolocation permission | Chrome Full support 43 | Edge Full support 79 | Firefox ? | IE No support No | Opera Full support 30 | Safari No support No | WebView Android No support No | Chrome Android Full support 43 | Firefox Android ? | Opera Android Full support 30 | Safari iOS No support No | Samsung Internet Android Full support 4.0 |
gyroscope permission | Chrome Full support 51 | Edge Full support 79 | Firefox ? | IE No support No | Opera ? | Safari No support No | WebView Android Full support 51 | Chrome Android Full support 51 | Firefox Android ? | Opera Android ? | Safari iOS No support No | Samsung Internet Android Full support 5.0 |
magnetometer permission | Chrome Full support 62 | Edge Full support 79 | Firefox ? | IE No support No | Opera ? | Safari No support No | WebView Android Full support 62 | Chrome Android Full support 62 | Firefox Android ? | Opera Android ? | Safari iOS No support No | Samsung Internet Android Full support 8.0 |
microphone permission | Chrome Full support 64 | Edge Full support 79 | Firefox ? | IE No support No | Opera ? | Safari No support No | WebView Android Full support 64 | Chrome Android Full support 64 | Firefox Android ? | Opera Android ? | Safari iOS No support No | Samsung Internet Android Full support 9.0 |
midi permission | Chrome Full support 43 | Edge Full support 79 | Firefox ? | IE No support No | Opera Full support 30 | Safari No support No | WebView Android No support No | Chrome Android Full support 43 | Firefox Android ? | Opera Android Full support 30 | Safari iOS No support No | Samsung Internet Android Full support 4.0 |
notifications permission | Chrome Full support 43 | Edge Full support 79 | Firefox ? | IE No support No | Opera Full support 30 | Safari No support No | WebView Android No support No | Chrome Android Full support 43 | Firefox Android ? | Opera Android Full support 30 | Safari iOS No support No | Samsung Internet Android Full support 4.0 |
payment-handler permission | Chrome Full support 66 | Edge Full support 79 | Firefox ? | IE No support No | Opera ? | Safari No support No | WebView Android Full support 66 | Chrome Android Full support 66 | Firefox Android ? | Opera Android ? | Safari iOS No support No | Samsung Internet Android Full support 9.0 |
persistent-storage permission | Chrome Full support 71 | Edge Full support 79 | Firefox Full support 53 | IE No support No | Opera Full support 58 | Safari No support No | WebView Android Full support 71 | Chrome Android Full support 71 | Firefox Android Full support 53 | Opera Android Full support 50 | Safari iOS No support No | Samsung Internet Android Full support 10.0 |
push permission | Chrome Full support 43 | Edge Full support 79 | Firefox ? | IE No support No | Opera Full support 30 | Safari No support No | WebView Android No support No | Chrome Android Full support 43 | Firefox Android ? | Opera Android Full support 30 | Safari iOS No support No | Samsung Internet Android Full support 4.0 |
query | Chrome Full support 43 | Edge Full support 79 | Firefox Full support 46 | IE No support No | Opera Full support Yes | Safari No support No | WebView Android Full support 43 | Chrome Android Full support 43 | Firefox Android Full support 46 | Opera Android Full support Yes | Safari iOS No support No | Samsung Internet Android Full support 4.0 |
request | Chrome Full support 46 | Edge Full support 79 | Firefox No support No | IE No support No | Opera ? | Safari No support No | WebView Android Full support 46 | Chrome Android Full support 46 | Firefox Android No support No | Opera Android ? | Safari iOS No support No | Samsung Internet Android Full support 5.0 |
requestAll | Chrome Full support 48 | Edge Full support 79 | Firefox No support No | IE No support No | Opera ? | Safari No support No | WebView Android Full support 48 | Chrome Android Full support 48 | Firefox Android No support No | Opera Android ? | Safari iOS No support No | Samsung Internet Android Full support 5.0 |
revoke | Chrome Full support 46 | Edge Full support 79 | Firefox
Full support
51
| IE No support No | Opera ? | Safari No support No | WebView Android Full support 46 | Chrome Android Full support 46 | Firefox Android
Full support
51
| Opera Android ? | Safari iOS No support No | Samsung 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.