问题
I need to test web application that extensively uses geo location api (getCurrentPosition, watchPosition). Is there any browser (Chrome, Firefox) plugin that allows to simulate geo location?
回答1:
If I understood the question correctly and you're asking for a way to fake geolocation responses for your web app, you might be able to do this in Firefox by overriding the geo.wifi.uri
in the prefs, like Firefox's unit tests do. See:
- http://mxr.mozilla.org/mozilla-central/source/dom/tests/mochitest/geolocation/geolocation_common.js?force=1
- http://mxr.mozilla.org/mozilla-central/source/dom/tests/mochitest/geolocation/network_geolocation.sjs?force=1 - the httpd.js script responding to requests of the
geo.wifi.uri
used in the tests.
回答2:
I am a bit late, but Microsoft Edge has this useful tab Emulation
.
You can open this developer tool as usual hitting F12
button or by clicking on the browser's menu button
, Developer Tools F12
.
Geolocation: Simulate a GPS receiver and enter GPS coordinates to test location-aware features in a webpage.
More info here at developer.microsoft.com
回答3:
Chromium 52 has it in-built:
- Open developer console
- Click the
:
button on the right, selectMore tools
->Sensors
- In Tab "Sensors" you can modify the current location:
来源:https://stackoverflow.com/questions/6704706/is-there-any-browser-chrome-firefox-plugin-that-allows-to-simulate-geo-locati