JS判断客户端是否是iOS或者Android手机移动端

if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
    //alert(navigator.userAgent);  
    window.location.href ="iPhone.html";
} else if (/(Android)/i.test(navigator.userAgent)) {
    //alert(navigator.userAgent); 
    window.location.href ="Android.html";
} else {
    window.location.href ="pc.html";
};

转:http://caibaojian.com/browser-ios-or-android.html
posted @ 2016-11-03 11:32  stma  阅读(95)  评论(0)    收藏  举报