Permissions
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.
* Some parts of this feature may have varying levels of support.
Note: This feature is available in Web Workers.
The Permissions interface of the Permissions API provides the core Permission API functionality, such as methods for querying and revoking permissions
Instance methods
Permissions.query()-
Returns the user permission status for a given API.
Permissions.revoke()-
Revokes the permission currently set on a given API.
Example
js
navigator.permissions.query({ name: "geolocation" }).then((result) => {
if (result.state === "granted") {
showLocalNewsWithGeolocation();
} else if (result.state === "prompt") {
showButtonToEnableLocalNews();
}
// Don't do anything if the permission was denied.
});
Specifications
| Specification |
|---|
| Permissions # permissions-interface |
Browser compatibility
| desktop | mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
Permissions
|
|
|
|
|
|
|
|
|
|
|
|
|
accelerometer permission
|
|
|
|
|
|
|
|
|
|
|
|
|
accessibility-events permission
|
|
|
|
|
|
|
|
|
|
|
|
|
ambient-light-sensor permission
|
|
|
|
|
|
|
|
|
|
|
|
|
background-sync permission
|
|
|
|
|
|
|
|
|
|
|
|
|
camera permission
|
|
|
|
|
|
|
|
|
|
|
|
|
captured-surface-control permission
|
|
|
|
|
|
|
|
|
|
|
|
|
clipboard-read permission
|
|
|
|
|
|
|
|
|
|
|
|
|
clipboard-write permission
|
|
|
|
|
|
|
|
|
|
|
|
|
geolocation permission
|
|
|
|
|
|
|
|
|
|
|
|
|
gyroscope permission
|
|
|
|
|
|
|
|
|
|
|
|
|
local-fonts permission
|
|
|
|
|
|
|
|
|
|
|
|
|
local-network permission
|
|
|
|
|
|
|
|
|
|
|
|
|
local-network-access permission
|
|
|
|
|
|
|
|
|
|
|
|
|
loopback-network permission
|
|
|
|
|
|
|
|
|
|
|
|
|
magnetometer permission
|
|
|
|
|
|
|
|
|
|
|
|
|
microphone permission
|
|
|
|
|
|
|
|
|
|
|
|
|
midi permission
|
|
|
|
|
|
|
|
|
|
|
|
|
notifications permission
|
|
|
|
|
|
|
|
|
|
|
|
|
payment-handler permission
|
|
|
|
|
|
|
|
|
|
|
|
|
persistent-storage permission
|
|
|
|
|
|
|
|
|
|
|
|
|
push permission
|
|
|
|
|
|
|
|
|
|
|
|
|
screen-wake-lock permission
|
|
|
|
|
|
|
|
|
|
|
|
|
storage-access permission
|
|
|
|
|
|
|
|
|
|
|
|
|
top-level-storage-access permission
|
|
|
|
|
|
|
|
|
|
|
|
|
window-management permission
|
|
|
|
|
|
|
|
|
|
|
|
|
query
|
|
|
|
|
|
|
|
|
|
|
|
|
request
|
|
|
|
|
|
|
|
|
|
|
|
|
requestAll
|
|
|
|
|
|
|
|
|
|
|
|
|
revoke
|
|
|
|
|
|
|
|
|
|
|
|
|
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Partial support
- Partial support
- No support
- No support
- Experimental. Expect behavior to change in the future.
- Non-standard. Check cross-browser support before using.
- Deprecated. Not for use in new websites.
- See implementation notes.
- User must explicitly enable this feature.
- Has more compatibility info.