This article is in need of a technical review.
This article is in need of an editorial review.
This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.
The PermissionStatus interface of the Permissions API provides the state of an object and an event handler for monitoring changes to said state.
Properties
PermissionStatus.stateRead only- One of
'granted','denied', or'prompt'. PermissionStatus.statusRead only- One of
'granted','denied', or'prompt'. Later versions of the specification replace this withPermissionStatus.state.
Event Handler
PermissionStatus.onchange- An event called whenever
PermissionStatus.statuschanges.
Example
navigator.permissions.query({name:'geolocation'}).then(function(permissionStatus) {
console.log('geolocation permission status is ', permissionStatus.status);
permissionStatus.onchange = function() {
console.log('geolocation permission status has changed to ', this.status);
};
});
Specification
| Specification | Status | Comment |
|---|---|---|
| Permissions API The definition of 'PermissionStatus' in that specification. |
Editor's Draft | Initial definition. |
Browser Support
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
|---|---|---|---|---|---|
| Basic support | 43.0 | ? | ? | ? | ? |
| status | Deprecated in 44 | ||||
| state | 44.0 |
| Feature | Android | Android Webview | Firefox Mobile (Gecko) | Firefox OS | IE Phone | Opera Mobile | Safari Mobile | Chrome for Android |
|---|---|---|---|---|---|---|---|---|
| Basic support | Not supported | 43.0 | ? | ? | ? | ? | ? | 43.0 |
| status | Deprecated in 44 | Deprecated in 44 | ||||||
| state | 44.0 | 44.0 |