zoukankan      html  css  js  c++  java
  • 手机浏览器_安卓_苹果手机Webview 中唤醒APP

    Url scheme是iOS,Android平台都支持,只需要原生APP开发时注册scheme, 那么用户点击到此类链接时,会自动跳到APP。比如

    <!-- 打开考拉APP首页 -->
    <a href="kaola://www.kaola.com">打开APP</a>
    <!-- 呼叫号码 -->
    <a href="tel://13788889999">打开拨号</a>
     
    以下是各大APP的scheme
    //1、淘宝:“taobao://”
    //2、支付宝:“alipays://platformapi/startapp?appId=20000067&url=”,20000067 代表钱包内部应用的ID
    //3、天猫:“tmall://page.tm/webview?webURLString=”
    //4、淘宝电影:“tbmovie://taobao.com/h5jump?url=”
     
    微信无法打开或者下载,打开APP这个基本无解,下载则只能让应用进驻应用宝市场,然后检测到在微信中运行时,跳转到应用宝页面下载或者提示用浏览器打开页面唤醒APP。
     
    如果想加载页面就判断有没有安装则执行以下代码:
    <script>
    function makeHiddenIframe(url) {
    var ua = navigator.userAgent.toLowerCase();
    if( ua.match(/iphone os 9/i) == "iphone os 9" ) {
    window.setTimeout(function() {location.href = url;},100);
    }else{
    var ifa = document.createElement('iframe');
    ifa.style.display = 'none';
    ifa.src = url;
    document.body.appendChild(ifa);
    var openTime = +new Date();
    window.setTimeout(function(){
    document.body.removeChild(ifa);
    if( (+new Date()) - openTime > 2500 ){
    location.href = url;
    }
    },2000);
    }
    }
    makeHiddenIframe('saaslunch://btdai/haha');
    </script>
    

      

  • 相关阅读:
    第01组 团队Git现场编程实战
    2019 SDN上机第1次作业
    第二次结对编程作业
    团队项目-需求分析报告
    团队项目-选题报告
    2019 SDN阅读作业
    2019 SDN上机第3次作业
    2019 SDN上机第2次作业
    2019 SDN上机第1次作业
    OpenDayLight安装Features
  • 原文地址:https://www.cnblogs.com/ckf1988/p/7490186.html
Copyright © 2011-2022 走看看