How to check for Crosswalk WebView user agent?

2019-07-09 05:07发布

I need to check if a mobile user is accessing the website through a Crosswalk WebView and enable/disable some niceties.

How can I check if user is accessing using Crosswalk WebView? What is the user string for Crosswalk WebView?

1条回答
做自己的国王
2楼-- · 2019-07-09 05:18

Found the correct user agent string for crosswalk webview on GitHub:

if(navigator.userAgent.toLowerCase().indexOf('crosswalk') > -1) {
    // this is crosswalk view
} else {
    // this is NOT crosswalk view
}
查看更多
登录 后发表回答