科尔多瓦Android不允许向fb-messenger打开列入白名单的意图

时间:2019-05-25 20:15:37

标签: android facebook cordova ionic3 cordova-plugins

我有一个适用于Android的Ionic Cordova应用程序,该应用程序具有一个指向Facebook Messenger的按钮:

<a href="https://m.me/my-fb-page" target="_blank"><img src="assets/images/messenger.svg" /></a>

点击时,屏幕上不显示任何内容。我一直通过logcat收到此错误:

CordovaWebViewImpl: Blocked (possibly sub-frame) navigation to non-allowed URL: intent://user/xxxxxxxxxxxxx/?intent_trigger=mme&nav=discover#Intent;scheme=fb-messenger;package=com.facebook.orca;end

我已经安装了cordova-plugin-whitelist。

config.xml的内容:

    ...
    <content src="index.html" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-navigation href="*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <allow-intent href="fb-messenger:*" />
    <platform name="android">
        <allow-intent href="market:*" />
        <allow-intent href="fb-messenger:*" />
        ...

我尝试了多种用于允许意图,访问和允许导航的选项。

该问题与Facebook Messenger无关,我在打开其他外部(支付)应用程序时也遇到问题

1 个答案:

答案 0 :(得分:3)

使用'domain' => '.domain.com' 时,您告诉您的应用导航到每个URL,这会阻止任何<allow-navigation href="*" />正常工作,因为它将尝试导航至该URL,而不是启动意图。