码迷,mamicode.com
首页 > 移动开发 > 详细

h5页面拉起手机内的APP

时间:2017-09-18 19:45:40      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:http   set   and   nes   下载   ble   测试   yun   maximum   

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>测试</title>
        <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
    </head>
    <body>
    <div></div>
    <script>
    var url_ios = "Cgtz://songjiangdai"   //ios打开链接
    var url_ios_download=  "https://itunes.apple.com/cn/app/song-jiang-dai/id984424855?mt=8" //ios下载地址
    var url_android = "sjd://lg.app" //安卓打卡链接
    var url_android_download = "https://cgtzfiles.b0.upaiyun.com//cgjr/jrwx/apk/songjiangdai_release_2.2.2_dx.apk"//安卓下载地址
    if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)){  //判断ios手机
        var loadTime = new Date();
          window.location.href=url_ios   //打开手机内的app
        setTimeout(function(){   //两秒后下载APP
            var outTime = new Date()
            if(outTime - loadTime > 800){
                location.href = url_ios_download;
            }
        },2000)
    }else { //安卓手机
        var loadTime = new Date();
        location.href = url_android;//打开手机内的app
        setTimeout(function(){  //两秒后下载APP
            var outTime = new Date()
            if(outTime - loadTime > 800){
                location.href = url_android_download;
            }
        },2000)
    }
        </script>
    </body>
</html>

 

h5页面拉起手机内的APP

标签:http   set   and   nes   下载   ble   测试   yun   maximum   

原文地址:http://www.cnblogs.com/liyuanqing/p/7544642.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!