判断是否是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;
}

你可能感兴趣的:(javascript)