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