且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

判断手机操作系统是安卓还是苹果,显示不同的标志

更新时间:2022-06-03 04:56:06

<div id="android_download" class="app" style="display:none"><a href="#">APP下载</a></div>
            <script>
                if(navigator.userAgent.indexOf("Kenfor")==-1 && navigator.userAgent.indexOf("Android")!=-1){
                    document.getElementById("android_download").style.display = "block";
                }
            </script>
            <div id="iphone_download" class="app" style="display:none"><a href="#">APP下载</a></div>    
            <script>
                if(navigator.userAgent.indexOf("kenfor")==-1 && navigator.userAgent.indexOf("iPhone")!=-1){
                    document.getElementById("iphone_download").style.display = "block";
                }
            </script>