发布时间:2023-04-18 文章分类:编程知识 投稿人:李佳 字号: 默认 | | 超大 打印
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/';     //移动端域名
                }
            }