首页 > 移动平台 > 详细

判断当前设备是移动设备还是PC

时间:2015-03-02 16:39:00      阅读:222      评论:0      收藏:0      [点我收藏+]
var system={
			userAgent:navigator.userAgent.toLowerCase(),
			name:function() {
	            var bIsIpad = this.userAgent.match(/ipad/i) == "ipad";
	            var bIsIphoneOs = this.userAgent.match(/iphone os/i) == "iphone os";
	            var bIsMidp = this.userAgent.match(/midp/i) == "midp";
	            var bIsUc7 = this.userAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
	            var bIsUc = this.userAgent.match(/ucweb/i) == "ucweb";
	            var bIsAndroid = this.userAgent.match(/android/i) == "android";
	            var bIsCE = this.userAgent.match(/windows ce/i) == "windows ce";
	            var bIsWM = this.userAgent.match(/windows mobile/i) == "windows mobile";
	            var bIsPlayBook = this.userAgent.match(/playbook/i) == "playbook";
	            var bIsBlackBerry = this.userAgent.match(/bb10/i) == "bb10";
	            if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM|| bIsPlayBook|| bIsBlackBerry) {
	                return "phone";
	            } else {
	                return "pc";
	            }
	        }
        };

判断当前设备是移动设备还是PC

原文:http://www.cnblogs.com/Frant-Jamie/p/4308906.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!