//判断手机端操作系统(Andorid/IOS),并自动跳转相应下载界面
androidURL ="http://xxx/xxx.apk";

  var browser = {  
       versions: function() {  
             var u = navigator.userAgent,  
                 app = navigator.appVersion;  
             return {  
                     android: u.indexOf("Android") > -1 || u.indexOf("Linux") >-1,  
                     iPhone: u.indexOf("iPhone") > -1 ,  
                     iPad: u.indexOf("iPad") >-1,  
                     iPod: u.indexOf("iPod") > -1,  
                   };  
             } (),  
        language: (navigator.browserLanguage || navigator.language).toLowerCase()  
     }  

     if (browser.versions.iPhone||browser.versions.iPad||browser.versions.iPod)  
         {  
            //如果是ios系統,直接跳轉至appstore該應用首頁,傳遞参數为該應用在appstroe的id號  
            window.location.href="itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=123456";  
         }  
         else if(browser.versions.android)  
         {  
            window.location.href = androidURL;  
         }  

/* //第二种方法  
    if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {  
        //alert(navigator.userAgent);  
        window.location.href ="iPhone.html";  
    } else if (/(Android)/i.test(navigator.userAgent)) {  
        //alert(navigator.userAgent);  
        window.location.href ="Android.html";  
    } else {  
        window.location.href ="pc.html";  
    };  




*/

相关文章:

  • 2022-12-23
  • 2021-06-07
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2022-12-23
  • 2021-05-27
  • 2022-12-23
猜你喜欢
  • 2021-12-02
  • 2022-12-23
  • 2021-12-28
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案