問題描述
是否有任何簡單的方法來覆蓋 geolocation api 的默認行為并且只是硬編碼你現在的位置?
Are there any easy ways to override the default behaviors of the geolocation api and just hard code your current location?
我認為這對于測試和出于隱私原因(提供虛假位置數據)很有用
I think this would be useful for testing and for privacy reasons (providing fake location data)
我以為有一個附加功能,但我似乎找不到.現在唯一的選擇似乎是將 about:config geo.wifi.url 更改為一些替代網絡服務,我認為這過于復雜.
I thought there was an add on for this but I can't seem to find one. Only option right now seems to be changing the about:config geo.wifi.url to some alternative webservice, which I consider overly complicated.
有什么想法嗎?
謝謝
理想場景
有人實現了一個顯示谷歌地圖的插件,我可以選擇一個新的默認位置.
Somebody implements an add-on where a google map appears and I can pick a new default location.
推薦答案
geo.wifi.uri 不需要是 web 服務.您也可以使用 file://...
The geo.wifi.uri does not need to be a webservice. You can also set it to a local uri with file://...
文件應該是一個json文件,內容如下:
The file should be a json file with content like this:
{"location": {
"latitude": 48.777025000000002,
"longitude": 9.1713909999999998,
"accuracy": 10.0}}
更新:對于 Firefox 9+,格式已更改:
Update: For Firefox 9+, the format has changed:
{
"status": "OK",
"accuracy": 10.0,
"location": {"lat": 48.777, "lng": 9.171}
}
或者您可以將它們結合起來支持兩者:
Or you can combine them to support both:
{
"status": "OK",
"accuracy": 10.0,
"location": {
"lat": 48.777,
"lng": 9.171,
"latitude": 48.777,
"longitude": 9.171,
"accuracy": 10.0
}
}
更新:看起來手動設置此首選項被假設為 Google 服務的提供商阻止.請參閱 錯誤 716453更新 2: geo.wifi.uri 不是 geo.wifi.url
Update: it looks like manually setting this preference is blocked by the provider assuming the Google service. See Bug 716453 Update 2: geo.wifi.uri not geo.wifi.url
這篇關于允許手動輸入的 Firefox 地理定位提供程序的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!