問題描述
有誰知道是否有辦法測試是否已授予先前的 html5 地理定位權限?
Does anyone know if there is a way to test if prior html5 geolocation permission has been granted?
我嘗試制作一個不請求地理位置的腳本,除非該頁面已獲得許可.不一定非得是 html5;其他框架也可以.
I try to make a script that does not request the geolocation unless the permission for the page has already been given. Does not nessicerily have to be html5; other frameworks are also ok.
推薦答案
根據Geolocation API Specification沒有任何功能.甚至將其保存在瀏覽器首選項中的選項也不會推送到您的代碼中.
According to the Geolocation API Specification there isn't any function for this. Even the option to save it in the browser preferences isn't pushed to your code.
如果它真的很重要并且你真的必須意識到這一點,你必須為每個常見的瀏覽器編寫一個瀏覽器插件并要求用戶安裝它.但我不會懷疑.
If it's realy important and you realy have to beeing aware of this, you have to write a browser addon for every common browser and ask the user to install it. But i wouldn't doubt of it.
這篇關于測試是否已授予 html5 地理定位權限的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!