How to check for Crosswalk WebView user agent?

对着背影说爱祢 提交于 2019-12-24 05:26:22

问题


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:


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
}


来源:https://stackoverflow.com/questions/36945869/how-to-check-for-crosswalk-webview-user-agent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!