<!-- 判断浏览器是否为手机端 -->
<script>
// class
! function(navigator) {
var userAgent = navigator.userAgent;
documentElement = document.documentElement;
if (userAgent.match(/micromessenger\/5/gi)) {
documentElement.className += " mobile wx_mobile wx_mobile_5";
} else if (userAgent.match(/micromessenger/gi)) {
documentElement.className += " mobile wx_mobile";
} else if (userAgent.match(/ucbrowser/gi)) {
documentElement.className += " mobile uc_mobile";
} else if (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent.toLowerCase())) {
documentElement.className += " mobile";
} else if (userAgent.toLowerCase().match(/msie/gi) && (parseFloat(userAgent.toLowerCase().match(/msie ([0-9]{1,}[\.0-9]{0,})/i)[1] || 999) < 9)) {
documentElement.className += " pc pc-ie pc-ie8";
} else if (userAgent.toLowerCase().match(/msie/gi) || navigator.msPointerEnabled || navigator.pointerEnabled) {
documentElement.className += " pc pc-ie";
} else {
documentElement.className += " pc";
ispc = true;
}
/* 如果是Pc端,则打开下面这页面 */
if(isPc){
window.location.href='url';
}
/* 如果不是pc端,则打开下面这页面*/
/* if(!isPc){
window.location.href='url';
} */
}(navigator);
// meta
! function(userAgent) {
var screen_w = parseInt(window.screen.width),
scale = screen_w / 640;
if (/Android (\d+\.\d+)/.test(userAgent)) {
var version = parseFloat(RegExp.$1);
document.write(version > 2.3 ? '<meta name="viewport" content="width=640, minimum-scale = ' + scale + ", maximum-scale = " + scale + ', target-densitydpi=device-dpi">' : '<meta name="viewport" content="width=640 target-densitydpi=device-dpi">');
} else {
document.write('<meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi">');
}
}(navigator.userAgent);
</script>