允许手动输入的 Firefox 地理定位提供程序

Geolocation provider for Firefox that allows manual input(允许手动输入的 Firefox 地理定位提供程序)
本文介绍了允许手动输入的 Firefox 地理定位提供程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

是否有任何简单的方法来覆盖 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 地理定位提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

SCRIPT5: Access is denied in IE9 on xmlhttprequest(SCRIPT5:在 IE9 中对 xmlhttprequest 的访问被拒绝)
XMLHttpRequest module not defined/found(XMLHttpRequest 模块未定义/未找到)
Show a progress bar for downloading files using XHR2/AJAX(显示使用 XHR2/AJAX 下载文件的进度条)
How can I open a JSON file in JavaScript without jQuery?(如何在没有 jQuery 的情况下在 JavaScript 中打开 JSON 文件?)
quot;Origin null is not allowed by Access-Control-Allow-Originquot; in Chrome. Why?(“Access-Control-Allow-Origin 不允许 Origin null在铬.为什么?)
How to get response url in XMLHttpRequest?(如何在 XMLHttpRequest 中获取响应 url?)