html - 如何在 cordova webview 之外打开 <a href> 链接(在 Safari 或 Google map 中)?

标签 html ios cordova google-maps taco

我使用本教程创建了一个托管应用程序: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/

相关文章:

html - 设置图像与其他图像的高度

javascript - 表上的 jQuery slideToggle 滞后然后切换(无幻灯片)

php - 无法从数据库中提取并在 PHP 中显示

ios - 更改框架后 UIContainerView 停止接收触摸

javascript 在网络应用程序中不起作用

html - 试图删除页面中间的 hr 分隔符,但似乎无法在任何地方找到它?

ios - 有没有办法观察在对象(iOS)上调用的每个消息调用?

ios - UICollectionViewCell 带有图像但没有自定义类

ios - 缺少配置文件 :Apps must contain a provisioning profile in a file named embedded. mobileprovision

ios - 修改 "*-Info.plist"CFBundleURLTypes 的两个 cordova 插件