{{APIRef("Permissions API")}}{{SeeCompatTable}}
The Permissions interface of the Permissions API provides a method for querying the status of a user permission on the global scope.
Method
- {{domxref("Permissions.query")}}
- Returns the status of a user permission on the global scope.
Example
navigator.permissions.query({name:'geolocation'}).then(function(result) { if (result.status == 'granted') { showLocalNewsWithGeolocation(); } else if (result.status == 'prompt') { showButtonToEnableLocalNews(); } // Don't do anything if the permission was denied. });
Specification
Specification | Status | Comment |
---|---|---|
{{SpecName('Permissions API', '#permissions-interface', 'Permissions')}} | {{Spec2('Permissions API')}} | Initial definition. |
Browser Support
{{ CompatibilityTable() }}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | {{CompatChrome(43.0)}} | {{CompatUnknown()}} | {{CompatUnknown()}} | {{CompatUnknown()}} | {{CompatUnknown()}} |
Feature | Android | Chrome Mobile | Firefox Mobile (Gecko) | Firefox OS | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | {{CompatNo()}} | {{CompatChrome(43.0)}} | {{CompatUnknown()}} | {{CompatUnknown()}} | {{CompatUnknown()}} | {{CompatUnknown()}} | {{CompatUnknown()}} |