我使用本教程创建了一个托管应用程序:Microsoft Tutorial Page
在此网络应用程序中,有 <a href>
打开 Google map 的可用链接如下:
<a href=""https://maps.google.com/?q=" + myAddressString target="_system"> Address URL </a>
点击此href时,它会将我的应用置于后台模式,并在 GoogleMap 应用程序或 Safari 浏览器中打开 map 。
但有时,同一个链接会在我的托管 cordova 应用程序 webview 本身中打开 map URL,因此,我的应用程序消失了,用户无法返回到我的应用程序。
任何人都可以建议如何将 map 网址嵌入到托管网络应用程序中。
注意:我已经在我的应用程序中使用了 InAppBrowser cordova 插件。
配置文件:
<access origin="*" />
<access origin="http://*/*" />
<access origin="https://*/*" />
<access origin="content:///*" />
<access origin="https://*google.com/*" />
<access origin="https://maps.google.com/*" />
<access origin="https://*.mywebsite.com/*" />
<access origin="https://*.myotherwebsite.com/*" />
<access origin="https://accounts.mywebsite.com/*" />
<access origin="https://accounts.myotherwebsite.com/*" />
<access origin="https://officerapp.mywebsite.com/*" />
<access origin="https://officerapp.myotherwebsite.com/*" />
<allow-intent href="*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="https://*google.com/*" />
<allow-intent href="https://maps.google.com/*" />
<allow-intent href="https://accounts.mywebsite.com/*" />
<allow-intent href="https://accounts.myotherwebsite.com/*" />
<allow-intent href="https://officerapp.mywebsite.com/*" />
<allow-intent href="https://officerapp.myotherwebsite.com/*" />
<allow-navigation href="https://accounts.mywebsite.com/*" />
<allow-navigation href="https://accounts.myotherwebsite.com/*" />
<allow-navigation href="https://myapp.mywebsite.com/*" />
<allow-navigation href="https://myapp.myotherwebsite.com/*" />
最佳答案
这很简单,尝试打开它,就像在新选项卡中打开链接一样。只需将此属性添加到您的代码中即可:
target="_blank"
所以,你有:
<a href=""https://maps.google.com/?q=" + myAddressString target="_blank"> Address URL </a>
关于html - 如何在 cordova webview 之外打开 <a href> 链接(在 Safari 或 Google map 中)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44151941/