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>
    

      

  • 相关阅读:
    剑指offer14-链表中倒数第k个结点
    剑指offer15-翻转链表
    Matlab矩阵操作
    CUDA线程
    CUDA编程前言
    ROS常用工具
    ROS理解参数服务器param demo
    ROS手动编写服务端和客户端service demo(C++)
    ROS手动编写消息发布器和订阅器topic demo(C++)
    ROS参数服务器(Parameter Server)
  • 原文地址:https://www.cnblogs.com/ckf1988/p/7490186.html
Copyright © 2011-2022 走看看