JS判断iPhone|iPad|iPod|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";  
}; 

  

posted @ 2020-06-30 14:27  挥不去的执念  阅读(360)  评论(0编辑  收藏  举报