检测是PC的浏览器还是移动端的浏览器

<!--检测是PC的浏览器还是移动端的浏览器-->
<script type="text/javascript">
var curURL = window.location.href;
if (/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))) {
//手机端浏览器
if (curURL.indexOf("xw.qq.com") === -1) {
window.location.href = "http://xw.qq.com/";
}
} else {
//pc端浏览器
}
</script>
posted @ 2016-05-22 11:04  kpengfang  阅读(1069)  评论(0)    收藏  举报