zoukankan      html  css  js  c++  java
  • JavaScript 判断手机端操作系统(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;
                } 
    
  • 相关阅读:
    DRF分页器
    DRF版本控制
    crrm复习
    python面试题网络编程和数据库
    python基础面试题
    前端格式
    数据库基本命令
    数据库管理系统
    线程协程和进程
    IPC通信
  • 原文地址:https://www.cnblogs.com/xcxcxcxc/p/5541161.html
Copyright © 2011-2022 走看看