【问题标题】:cordova-plugin-inappbrowser interferes with tel: and sms:cordova-plugin-inappbrowser 干扰电话:和短信:
【发布时间】:2017-09-20 22:45:00
【问题描述】:

我在 Cordova 7 上,我注意到当我添加 cordova-plugin-inappbrowser@1.7.1 时,它会破坏我在 iOS 和 Android 上的 window.open() 中的 tel:sms: 链接.

这是我从 JS 发出的调用:

window.open(`sms:1231231234}`, '_self');

这是我在 config.xml 中设置访问块的方式:

<allow-intent href="tel:*" />
<allow-intent href="geo:*" />
<allow-intent href="mailto:*" />
<allow-intent href="sms:*" />
<allow-intent href="market:*" />
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<access origin="*" />

这是我目前正在使用的插件:

cordova-plugin-camera@2.4.1
cordova-plugin-console@1.0.7
cordova-plugin-crosswalk-certificate@2.0.1
cordova-plugin-crosswalk-webview@2.3.0
cordova-plugin-device@1.1.6
cordova-plugin-google-analytics@1.7.11
cordova-plugin-splashscreen@4.0.3
cordova-plugin-statusbar@2.2.3
cordova-plugin-whitelist@1.3.2
ionic-plugin-keyboard@2.2.1

知道如何避免这种情况吗?我只需要 InAppBrowser 打开一个外部网页,但我需要我的手机链接才能继续工作。

【问题讨论】:

  • 如果你 window.open() 一个 http:// url 会发生什么?
  • 使用 InAppBrowser,可以按预期工作。它在系统浏览器上打开站点(我的目标是_system)。
  • 听起来像 inappbrowser 接管了 window.open()。你从来没有设置 window.open = cordova.InAppBrowser.open 是吗?
  • 不,我不知道。我不确定 Ionic 是否会为我这样做。
  • 那也没用。最后只使用了 Ionic 的 inappbrowser、phonedialer、sms 和 email 插件。问题解决了。

标签: cordova cordova-plugins inappbrowser


【解决方案1】:

求助于使用这些插件来让它工作:

call-number@https://github.com/Rohfosho/CordovaCallNumberPlugin.git#7d6e87569b101a0abb3ba9259f17bfec0b1719d7
cordova-plugin-camera@2.4.1
cordova-plugin-console@1.0.7
cordova-plugin-crosswalk-certificate@2.0.1
cordova-plugin-crosswalk-webview@2.3.0
cordova-plugin-device@1.1.6
cordova-plugin-email@1.2.6
cordova-plugin-google-analytics@1.7.11
cordova-plugin-inappbrowser@1.7.1
cordova-plugin-splashscreen@4.0.3
cordova-plugin-statusbar@2.2.3
cordova-plugin-whitelist@1.3.2
cordova-sms-plugin@0.1.11
ionic-plugin-keyboard@2.2.1

【讨论】:

    【解决方案2】:

    您是否尝试将这些添加到配置文件中?

    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" /> 
    

    这对我有帮助。

    【讨论】:

    • 我上面有类似的东西。添加额外的意图没有帮助。
    猜你喜欢
    • 1970-01-01
    • 2018-03-07
    • 2019-11-07
    • 1970-01-01
    • 2022-10-14
    • 1970-01-01
    • 2019-06-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多