其他分享
首页 > 其他分享> > js判断是否安桌是否ios

js判断是否安桌是否ios

作者:互联网

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>AesDiyApp</title>
    <!-- CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" rel="stylesheet"
          integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <!-- jQuery and JavaScript Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"
            integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
            crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js"
            integrity="sha384-LCPyFKQyML7mqtS+4XytolfqyqSlcbB3bvDuH9vX2sdQMxRonb/M3b9EmhCNNNrV"
            crossorigin="anonymous"></script>
    <style type="text/css">
        /* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
                    for details on configuring this project to bundle and minify static web assets. */

        a.navbar-brand {
            white-space: normal;
            text-align: center;
            word-break: break-all;
        }

        /* Provide sufficient contrast against white background */
        a {
            color: #0366d6;
        }

        .btn-primary {
            color: #fff;
            background-color: #1b6ec2;
            border-color: #1861ac;
        }

        .nav-pills .nav-link.active, .nav-pills .show > .nav-link {
            color: #fff;
            background-color: #1b6ec2;
            border-color: #1861ac;
        }

        /* Sticky footer styles
        -------------------------------------------------- */
        html {
            font-size: 14px;
        }



        .border-top {
            border-top: 1px solid transparent;
        }

        .border-bottom {
            border-bottom: 1px solid #e5e5e5;
        }

        .box-shadow {
            box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
        }

        button.accept-policy {
            font-size: 1rem;
            line-height: inherit;
        }

        /* Sticky footer styles
        -------------------------------------------------- */
        html {
            position: relative;
            min-height: 100%;
        }

        body {
            /* Margin bottom by footer height */
            margin-bottom: 60px;
        }

        body, button, input, select, textarea, h1, h2, h3, h4, h5, h6 {
            font-family: Microsoft YaHei,'宋体', Tahoma, Helvetica, Arial, "\5b8b\4f53", sans-serif;
        }
    </style>
    <script type="text/javascript">
        var browser={
            versions:function(){
                var u = navigator.userAgent, app = navigator.appVersion;
                return {
                    trident: u.indexOf('Trident') > -1, //IE内核
                    presto: u.indexOf('Presto') > -1, //opera内核
                    webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
                    gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1,//火狐内核
                    mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
                    ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
                    android: u.indexOf('Android') > -1 || u.indexOf('Adr') > -1|| u.indexOf('Linux') > -1, //android终端
                    iPhone: u.indexOf('iPhone') > -1 , //是否为iPhone或者QQHD浏览器
                    iPad: u.indexOf('iPad') > -1, //是否iPad
                    Chrome: u.indexOf('Chrome') > -1, //是否安桌
                    webApp: u.indexOf('Safari') == -1, //是否web应该程序,没有头部与底部
                    weixin: u.indexOf('MicroMessenger') > -1, //是否微信 (2015-01-22新增)
                    qq: u.match(/\sQQ/i) == "qq" //是否QQ
                };
            }(),
            language:(navigator.browserLanguage || navigator.language).toLowerCase()
        }
        $(document).ready(function () {
            if (browser.versions.android ) {
                $("#btnios").hide();
                window.location.href = "https://play.google.com/store/apps/details?id=com.hisilicon.dashcam";
                $("#btnandroid").show();
            }
            else if ( browser.versions.ios 
                || browser.versions.iPhone
                || browser.versions.iPad) { 
                $("#btnandroid").hide();
                window.location.href = "https://apps.apple.com/cn/app/koool-camera/id1488372912";
                $("#btnios").show();
            }
            else if(browser.versions.mobile)
            {
               // alert('移动端');
                $("#btnios").show();
                $("#btnandroid").show();
            }
            

        });
    </script>
</head>
<body>
    
    <div class=".container-fluid">
        <main role="main" class="pb-3">
            <br />  
            <div class="row justify-content-md-center">

                <div class="card  shadow-lg" style="width: 35rem;">
                    <div class="card-title text-center">
                        <h2 class="font-weight-bold">Aes Diy App</h2>
                        <img src="aesDiyApp.png" width="229" height="229" />
                        <br /> 
                        </div>
                        <div class="card-body float-left">
                            <h5>
                                如长时间停留在本页,无法进入下载页面<br />
                                请使用下列方法下载<br />
                                <br />
                                方法1:使用浏览器扫码下载
                                <br />
                                <br />
                                方法2:安卓手机在GoogPlay搜索AesDiy下载 <br />
                                AesDiy;苹果手机在Appstore搜索AesDiy下 <br />
                                载AesDiy <br />
                                <br />
                                方法3:复制以下链接在其他浏览器粘贴打开 <br />
                                下载连接:
                                http://aesapps.auctus.cn/diy/download.html 
                                <br />
                                <br />
                            </h5>
                            <a id="btnandroid" class="btn btn-primary" href="https://play.google.com/store/apps/details?id=com.hisilicon.dashcam" role="button">安卓下载</a>
                            <a id="btnios" class="btn btn-primary" href="https://apps.apple.com/cn/app/koool-camera/id1488372912" role="button">苹果下载</a>
                        </div>
                    </div>



            </div>

        </main>
    </div> 
</body>
</html>

 

标签:versions,indexOf,show,ios,js,color,安桌,border,browser
来源: https://www.cnblogs.com/robertyao/p/14708503.html