您可以使用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.});你可以从这里阅读更多。