Js 识别 Android 或 Ios

    var ua = navigator.userAgent.toLowerCase(); 
    if (/iphone|ipad|ipod/.test(ua)) {
            alert("ios");       
    } else if (/android/.test(ua)) {
            alert("android");   
    }

navigator.userAgent


alert() 内容换行:“\n” 即可。

猜你喜欢

转载自blog.csdn.net/a58yyxg/article/details/53893687