admin管理员组文章数量:1202226
I'm currently working on some geolocation javascripts, but am unable to test and debug them properly: My desktop machine (Running Windows, with Chrome 5 or Firefox 3) doesn't have location information and my mobile devices don't feature any debugging capabilities.
How can I test geolocation scripts? Is there a tool which will fake a GPS sensor?
I'm currently working on some geolocation javascripts, but am unable to test and debug them properly: My desktop machine (Running Windows, with Chrome 5 or Firefox 3) doesn't have location information and my mobile devices don't feature any debugging capabilities.
How can I test geolocation scripts? Is there a tool which will fake a GPS sensor?
Share Improve this question asked Jul 6, 2010 at 8:45 Christian StuderChristian Studer 25.6k6 gold badges49 silver badges71 bronze badges 1- I found two Firefox add-ons (Geolocater and Geolocation) so far, but the two don't seem to be working. There are no Chrome extensions currently aviable. – Christian Studer Commented Jul 6, 2010 at 8:59
5 Answers
Reset to default 7In Firefox, it's possible to switch the default Geolocation provider (Google) to a manually entered source.
Fake your geolocation in Firefox 3.5
All you need for faking is a text file (eg.
/home/username/.mynewlocation.txt
) somewhere on your computer with the following content:{"location":{"latitude":50.941863,"longitude":6.958374, "accuracy":20.0}}
The path in Firefox to this file is:
file://home/username/.mynewlocation.txt
Type about:config in your location bar, confirm the warning, search for geo.wifi.url, and replace the old url (
https://www.google.com/loc/json
) with your new one from above. Restart firefox, enjoy your new location :-)
And there's a similar SO question with a number of good answers as well.
In chrome, you can now use the manual geolocation chrome extension to set your location manually.
Chrome now (tested in version 25) supports Geolocation spoofing via Developer Tools
the geo-location-javascript library contains a component for simulating locations, you simply add them with:
locations=new Array();
locations.push({ coords:{latitude:41.39985,longitude:2.19610},duration:5000 });
locations.push({ coords:{latitude:41.40,longitude:2.197},duration:5000 });
and the you initialize the component. look under simulation on the homepage
If the location you want to test is based on geolocation API in HTML5, you can fake the location by this extension.
https://chrome.google.com/webstore/detail/change-geolocation/njjpmclekpigefnogajiknnheheacoaj?hl=ja
本文标签: How do I test geolocation javascriptsStack Overflow
版权声明:本文标题:How do I test geolocation javascripts? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738584656a2101360.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论