1. 程式人生 > >h5頁面拉起手機內的APP

h5頁面拉起手機內的APP

win 下載 安卓 var cnblogs logs initial release tle

<!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