您的位置:首页 > Web前端 > JavaScript

js 判断当前的手机系统类型

2016-12-27 18:26 411 查看
js 判断当前的手机系统类型

<script language="javascript">

window.onload = 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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: