/** * 判断是不是webview环境 */ function isWebview () { var ua = navigator.userAgent; var platform = navigator.platform; var chrome = ua.match(/Chrome\/([\d.]+)/) || ua.match(/CriOS\/([\d.]+)/); var webview = !chrome && ua.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/); return webview; }