JS区分移动端和PC

1         var ua = navigator.userAgent.toLowerCase();
2         if (ua.match(/MicroMessenger/i) == "micromessenger"
3         || ua.match(/iphone os/i) == "iphone os" || ua.match(/ipad/i) == "ipad"
4         || ua.match(/android/i) == "android" || ua.match(/midp/i) == "midp"
5         || ua.match(/rv:1.2.3.4/i) == "rv:1.2.3.4" || ua.match(/ucweb/i) == "ucweb"
6         || ua.match(/windows ce/i) == "windows ce" || ua.match(/windows mobile/i) == "windows mobile") {
7            alert("移动端");8         }
原文地址:https://www.cnblogs.com/liuph/p/6101510.html