标签:
var ua = navigator.userAgent; var ipad = ua.match(/(iPad).*OS\s([\d_]+)/), isIphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/), isAndroid = ua.match(/(Android)\s+([\d.]+)/), isMobile = isIphone || isAndroid; if(isMobile) { location.href = ‘http://m.domain.com‘; }else{ location.href = ‘http://www.domain.com‘; } //或者单独判断iphone或android if(isIphone){ //code else if(isAndroid){ //code }else{ //code }
标签:
原文地址:http://www.cnblogs.com/goody9807/p/5153973.html