1. 程式人生 > >javascript判斷pc還是手機端

javascript判斷pc還是手機端

tor turn rip 手機 iphone phone asc ++ break

function IsPC() {
    var userAgentInfo = navigator.userAgent;
    var Agents = ["Android", "iPhone",
                "SymbianOS", "Windows Phone",
                "iPad", "iPod"];
    var flag = true;
    for (var v = 0; v < Agents.length; v++) {
        if (userAgentInfo.indexOf(Agents[v]) > 0
) { flag = false; break; } } return flag; }

http://www.jb51.net/article/48939.htm

javascript判斷pc還是手機端