js判斷設備是iOS還是安卓


<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" />

<title></title>

<style>div{width: 200px;height: 200px;background: #f06;}</style>

</head>

<body>

<div id="download">點擊判斷設備是iOS還是安卓</div>

<script src="js/jquery.js"></script>

<script>

var download = {

downloadApp : function(){

var xt = navigator.userAgent;

if(xt.indexOf("OS") > -1){

window.location.href="http://www.baidu.com";

}else{

window.location.href="http://3g.163.com/touch/all?dataversion=A&version=v_standard";

}

}

};

$(function(){

$("#download").click(function(){

download.downloadApp();

});

})

</script>

</body>

</html>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM