如何检查网络应用程序中是否支持 google.navigation 意图/url 方案?

发布于 2024-12-08 21:13:05 字数 378 浏览 1 评论 0原文

我想知道,使用javascript,

location = "google.navigation:q="+myDestAddress;

在实际调用它之前是否支持这样的内容:以及它是否不恢复为普通的旧谷歌地图网址:

location = "http://maps.google.com/maps?saddr="+myStartAddress+"&daddr="+myDestAddress;

注意:我已经使用用户检查该设备是否是android设备代理,但这还不够,因为据我所知,“google.navigation”意图仅在美国受支持,并且仅在某些设备/操作系统版本上受支持。

谢谢!

I would like to know, using javascript, if something like this:

location = "google.navigation:q="+myDestAddress;

is supported before actually invoking it, and if it is not revert to the plain old google maps url:

location = "http://maps.google.com/maps?saddr="+myStartAddress+"&daddr="+myDestAddress;

Note: I already check that the device is an android one using the user agent, but that is not enough as, as far as I know, the "google.navigation" intent is only supported in the US and only on some devices/OS versions.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吾性傲以野 2024-12-15 21:13:05

我想您正在寻找:

if(typeof google == "undefined" || typeof google.navigation == "undefined") {
    location = "http://maps.google.com/maps?saddr="+myStartAddress+"&daddr="+myDestAddress;
else {
    location = "google.navigation:q="+myDestAddress;
}

I think you're looking for:

if(typeof google == "undefined" || typeof google.navigation == "undefined") {
    location = "http://maps.google.com/maps?saddr="+myStartAddress+"&daddr="+myDestAddress;
else {
    location = "google.navigation:q="+myDestAddress;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文