点击一个谷歌地图链接后,无法回头 [英] Can't go back after clicking on a Google Maps link
问题描述
在我的应用程序,$ C $与科尔多瓦CD,有喜欢的链接:
In my app, coded with Cordova, there are links like:
<a href="http://maps.google.com/maps?q=London,+GB">Show map for London</a>
当他们点击,谷歌地图打开并显示正确的地址。问题是,我无法通过点击后退按钮返回到我的应用程序。
When clicking on them, Google Maps opens and shows the correct address. The problem is that I can't go back to my app by tapping on the back button.
我想这是因为我重写后退按钮
事件侦听器。事实上,如果我注释掉以下行:
I think it's because I'm overwriting the backbutton
event listener. In fact, If I comment out the following line:
document.addEventListener("backbutton", historyBack, true);
一切工作正常。事情是,我明明想叫我的自定义时pressing后退按钮 historyBack()
功能。即使 historyBack()
函数只包含警报(测试);
不火$ P时$ pssing后退按钮,同时查看地图。
Everything works fine. The thing is that I obviously want to call my custom historyBack()
function when pressing the back button. Even if the historyBack()
function only contains alert("test");
it doesn't fire when pressing the back button while viewing the map.
有任何解决方法这个问题?
Is there any workaround to this issue?
推荐答案
在Android上,地址更改为:
On Android, change the address to:
<a href="geo:0,0?q=London,+GB" target="_blank">Show map for London</a>
这将打开实际谷歌地图应用(或您选择的任何其他应用程序),而不是显示你的应用程序里的地图。
This will open the actual Google Maps app (or any other app of your choice), instead of showing the map inside your app.
这篇关于点击一个谷歌地图链接后,无法回头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!