JS判断手机系统

<script language="javascript">javascript

window.onload = function () {html

alert("1");java

//alert(navigator.userAgent.indexOf());spa

var u = navigator.userAgent;htm

if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) {//安卓手机ip

alert("安卓手机");it

// window.location.href = "mobile/index.html";io

} else if (u.indexOf('iPhone') > -1) {//苹果手机function

// window.location.href = "mobile/index.html";mobile

alert("苹果手机");

} else if (u.indexOf('Windows Phone') > -1) {//winphone手机

alert("winphone手机");

// window.location.href = "mobile/index.html";

}

}

</script>

相关文章
相关标签/搜索