【问题标题】:Why tel:* links don't work on ios?为什么 tel:* 链接在 ios 上不起作用?
【发布时间】:2016-07-11 15:00:54
【问题描述】:

我将此添加到 config.xml

<access origin="*"/>
<access origin="tel:*" launch-external="yes"/>
<access origin="mailto:*" launch-external="yes"/>
<allow-intent href="*"/>
<allow-navigation href="*"/>
<allow-navigation href="tel:*"/>
<allow-navigation href="mailto:*"/>
<allow-navigation href="data:*"/>
<plugin name="cordova-plugin-whitelist" version="1" />

这个到 index.html:

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">

当我点击这样的链接时:&lt;a href="tel:+1234567"&gt;Call!&lt;/a&gt; ios 上没有任何反应(在 android 上运行良好)。

如果我将 config.xml 更改为:

<access origin="//*"/>
<access origin="tel:*" launch-external="yes"/>
<access origin="mailto:*" launch-external="yes"/>
<allow-intent href="//*"/>
<allow-navigation href="//*"/>
<allow-navigation href="tel:*"/>
<allow-navigation href="mailto:*"/>
<allow-navigation href="data:*"/>
<plugin name="cordova-plugin-whitelist" version="1" />

它调用,但对服务器的 ajax 请求停止工作。

【问题讨论】:

  • 如果你使用tel://而不是tel:,它是否有效?
  • 是的,应该是tel:+15555555555。没有斜线。
  • 你能解决这个问题吗?
  • 我仍然无法让它在带有 Ionic3 的 iOS 上运行...在 Android 上运行良好 - 在这里尝试了很多解决方案

标签: ios cordova cordova-plugins


【解决方案1】:

只需删除允许导航

<allow-navigation href="tel:*"/>
<allow-navigation href="mailto:*"/>

我不知道为什么,但它有效!

cordova-ios@4+wkwebview 会先让导航过滤器响应url,然后什么都不做!!

https://github.com/apache/cordova-plugin-wkwebview-engine/pull/20

【讨论】:

  • 删除 &lt;allow-navigation href="*" /&gt; 对我有用。
  • 删除允许导航 tel:* 和 mailto:* 会使 android 停止工作。 @Iwrestledabearonce。答案对我有用。
猜你喜欢
  • 2020-02-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-02-02
  • 1970-01-01
  • 2011-07-08
  • 2011-10-26
  • 1970-01-01
相关资源
最近更新 更多