Cordova app中点击打开微信功能

最近在项目须要一个功能就是,在cordova app中点击而后直接跳转到微信的公众号中让用户关注公众号,但后来发现微信sdk如今不支持这个接口了,无奈只能实现点击打开微信这个功能了。html

原本是使用下面这种方式实现的ios

try {
          if (typeof cordova != undefined) {
            let ref = cordova.InAppBrowser.open(
              "wechat://",
              "_system",
              "location=no"
            );
          }
        } catch (e) {
          alert("唤起失败")
        }

可是发如今安卓中没有做用,因此咱们这里采用了另外一种方式:微信

<a href="weixin://" class="action-callweixin">打开微信</a>
app

而后注意在app的config.xml文件中加上url

    <access launch-external="yes" origin="weixin:*" />code

    <allow-navigation href="*" />xml

    <allow-intent href="*" />
htm

后面两行若是不加的话在ios中会报“weixin://” url not set 错误的cordova