Why tel:* links don't work on ios?

老子叫甜甜 提交于 2019-12-12 20:41:15

问题


I added this to 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" />

And this to index.html:

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

When I'm clicking to a link like that: <a href="tel:+1234567">Call!</a> nothing happens on the ios (on the android it works well).

If I change my config.xml to:

<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" />

It calls, but ajax requests to server stop working.


回答1:


just remove allow-navigation

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

I don't why ,but it work!

cordova-ios@4+wkwebview will get the navigation filter first to respond for the url,and do nothing!!

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



来源:https://stackoverflow.com/questions/38310197/why-tel-links-dont-work-on-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!