h5唤醒app(适应分享页面)

//跳转
const IOSoptions = {
scheme: {//用来配置 URL Scheme 所必须的那些 v 字段。
protocol: ‘ulife’//APP 协议,URL Scheme 的 scheme 字段,就是你要打开的 APP 的标识。
},
intent: {//安卓原生谷歌浏览器必须传递 Intent 协议地址,才能唤起 APP。
package: ‘com.huanshuo.smarteducation’,
scheme: ‘’,
},
// APP 的 App Store 地址
appstore: ‘https://apps.apple.com/cn/app/id1536380455’,
// APP 的应用宝地址
yingyongbao: ‘//a.app.qq.com/o/simple.jsp?pkgname=com.ulife.app’,
// 唤端失败后跳转的地址。
fallback: ‘http://njtc.myulife.com.cn/down’,
timeout: 2000,
};

const IOScallLib = new CallApp(IOSoptions);


var urlID = window.location.search.split("?")[1].split("&")[0].split("=")[1]
// console.log(window.location)
// console.log(urlID)
// 立即使用 有app打开app 没有去下载
function userNow () {
    $("#openbtn").css("background","pink")
    // console.log('1',"huanshuo://data/share?id=" + urlID)
    let UA = window.navigator.userAgent
    // 微信浏览器
    if(UA.toLowerCase().indexOf("micromessenger") !== -1) {
        this.setState({
            tipShow: true
        })
        return
    }
    // 机型 iphone
    else if(UA.toLowerCase().indexOf("iphone") !== -1) {
        if(UA.match(/(iPhone|iPod|iPad);?/i)){
            IOScallLib.open({
                path:"SHUOHUIApp://?id=" + urlID
                // path:"https://a.app.qq.com/o/simple.jsp?pkgname=com.huanshuo.smarteducation"
            })
            location.href="SHUOHUIApp://?id=" + urlID
            // location.href="https://a.app.qq.com/o/simple.jsp?pkgname=com.huanshuo.smarteducation"
        }
    }
    // 机型 android
    else if(UA.toLowerCase().indexOf("android") !== -1) {
        /* android 唤起失败,原因不详,预估参数不准确
        ANDRIODcallLib.open({
          path: ''
        })
        */
        // 采用其他办法
        location.href="huanshuo://data/share?id=" + urlID
        document.querySelectorAll('.inviteDraw')[0].addEventListener('click', function() {
            window.location.href = "huanshuo://data/share?id=" + urlID
        }, false)
    }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值