js移動端判斷手機系統


<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>判斷手機型號</title>
<style type="text/css">
body{
font-size:200px;
}
</style>
</head>
<body>
<div class="ios"id="ios" >
判斷
</div>

</body>
<script src="jquery-1.7.2.min.js" type="text/javascript" charset="utf-8"></script>
<script language="javascript">

window.onload = function () {
$('.ios').on('click',function(){


alert("1");
var u = navigator.userAgent;
if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) {//安卓手機
alert("安卓手機");
// window.location.href = "mobile/index.html";
} else if (u.indexOf('iPhone') > -1) {//蘋果手機
// window.location.href = "mobile/index.html";
alert("蘋果手機");
} else if (u.indexOf('Windows Phone') > -1) {//winphone手機
alert("winphone手機");
// window.location.href = "mobile/index.html";
}
})
}
</script>
</html>


免責聲明!

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



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