Is there any browser (Chrome, Firefox) plugin that allows to simulate geo location?

丶灬走出姿态 提交于 2019-12-30 10:05:09

问题


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:

  1. Open developer console
  2. Click the : button on the right, select More tools -> Sensors
  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!