web-前端移动端和pc端进入不同的项目

判断手机端和pc端进入相反的项目

1.使用一个方法包含,vue项目中放入App.vue中,进入项目自执行!
2.如果是当前项目正在开发则不需要写当前地址跳转的网址,此为默认项!

var sUserAgent = navigator.userAgent.toLowerCase();
			var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
			var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
			var bIsMidp = sUserAgent.match(/midp/i) == "midp";
			var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
			var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
			var bIsAndroid = sUserAgent.match(/android/i) == "android";
			var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
			var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
			if(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {          //移动端打开的项目为当前的
               
			} else {    //电脑打开跳转此官网网址
				location.href = "http://www.baidu.com.cn/";  
			}复制代码

你可能感兴趣的:(web-前端移动端和pc端进入不同的项目)