自動檢測瀏覽器是手機仍是pc

1 function CheckBrower() {
2         if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {  //判斷iPhone|iPad|iPod|iOS
3             alert("iphone");
4         } else if (/(Android)/i.test(navigator.userAgent)) {   //判斷Android
5             alert("Android");
6         } else {  //pc
7             alert("pc");
8         };
9     }
相關文章
相關標籤/搜索