我想知道是否有一种方法可以在Chrome中查询以下权限:
accelerometer
camera
clipboard-read
clipboard-write
geolocation
background-sync
magnetometer
microphone
midi
notifications
payment-handler
persistent-storage
谢谢。
您可以仅使用navigator.permissions
这里是“地理位置”的示例:
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.
});
您可以从这里阅读更多内容。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句