gpt4 book ai didi

javascript - 如何测试地理位置 javascript?

转载 作者:可可西里 更新时间:2023-11-01 01:51:33 24 4
gpt4 key购买 nike

我目前正在处理一些地理定位 javascript,但无法正确测试和调试它们:我的台式机(运行 Windows,使用 Chrome 5 或 Firefox 3)没有位置信息,我的移动设备也没有具有任何调试功能。

如何测试地理定位脚本?是否有可以伪造 GPS 传感器的工具?

最佳答案

在 Firefox 中,可以将默认的地理位置提供程序 (Google) 切换为手动输入的来源。

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 :-)

还有 a similar SO question还有一些很好的答案。

关于javascript - 如何测试地理位置 javascript?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3184731/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com