判断是不是webview环境

/**
 * 判断是不是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;
}
相关文章
相关标签/搜索