CODE
<script> //判断终端url跳转 function sp_isMobile() { return Boolean(navigator.userAgent.match(/.*(iphone|ipod|android|symbian|nokia|blackberry| rim |opera mini|opera mobi|windows ce|windows phone|up.browser|netfront|palm-|palm os|pre/|palmsource|avantogo|webos|hiptop|iris|kddi|kindle|lg-|lge|mot-|motorola|nintendo ds|nitro|playstation portable|samsung|sanyo|sprint|sonyericsson|symbian).*/i) || navigator.userAgent.match(/alcatel|audiovox|bird|coral|cricket|docomo|edl|huawei|htc|gt-|lava|lct|lg|lynx|mobile|lenovo|maui|micromax|mot|myphone|nec|nexian|nook|pantech|pg|polaris|ppc|sch|sec|spice|tianyu|ustarcom|utstarcom|videocon|vodafone|winwap|zte/i)); } //移动端排除ipad if(sp_isMobile()&&location.search.indexOf('pc=true')==-1&&navigator.userAgent.indexOf('iPad')==-1) { //添加meta 方便移动端获取document.documentElement.clientWidth document.write('<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />'); if(document.documentElement.clientWidth>760){ location.href="http://www.xxxx.com/index.shtml?pc=true"; }else{ location.href="http://u.pa.com/upingan/upingan/index.html?mediasource=SC03-Direct-00002"; } } </script>