js判断是否手机模式

function autoLoad() {
                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"; //uc手机浏览器
                var bIsAndroid = sUserAgent.match(/android/i) == "android";
                var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce"; //windows 移动平台
                var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
                if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
                    window.location.href = 'http://m.abc.com/';     //移动端域名
                }
            }

 

热门相关:无量真仙   巡狩万界   寂静王冠   寂静王冠   霸皇纪