我使用以下代码,在Chrome和Firefox上运行良好,但在Safari上无法运行。在React js中,Safari浏览器的替代方案是什么?
navigator.permissions.query({name:'geolocation'}).then(function(result) {
if (result.state == 'granted') {
cb(true)
}else if(result.state == 'prompt'){
cb(false)
}
});