FInding the webkit version used in Android browser?

老子叫甜甜 提交于 2019-12-05 18:20:37

问题


Is there a way to tell which version of the webkit software is used in the Android browser on some specific handset?

What would be really great is if there is a URL you can browse to get that information. But any other way would be good too. If you know the webkit version, you know how much html5 suport to expect.


回答1:


On Android 2.3.3, at least, the version of Webkit is reflected in the user agent string.

When I go to WhatsMyUserAgent.com on my Android device with 2.3.3 (Cyanogenmod 7.0.3), I get:

Mozilla/5.0 (Linux; U; Android 2.3.3; en-us; HTC Vision Build/FRF91) AppleWebKit/533.1 (KHTML; like Gecko) Version/4.0 Mobile Safari/533.1



回答2:


This site has a summary for you http://jimbergman.net/webkit-version-in-android-version/




回答3:


When you type javascript:alert(navigator.userAgent) in the location bar you'll see the WebKit version listed e.g.

Emulator Mozilla/5.0 (Linux; U; Android 4.1.2; en-us; GT-N8000 Build/JZO54K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30




回答4:


WebView webView = new WebView(getApplicationContext());
String useragent=webView.getSettings().getUserAgentString();

The useragent is the reuslt like:

Mozilla/5.0 (Linux; Android 4.4.2; SM-N900 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36




回答5:


Also we can use

PackageInfo pi = getPackageManager().getPackageInfo("com.google.android.webview", 0);
String version = pi.versionName;



回答6:


There's a Javascript library from several years ago that can do this. Not sure how up-to-date it is: http://trac.webkit.org/wiki/DetectingWebKit



来源:https://stackoverflow.com/questions/5412518/finding-the-webkit-version-used-in-android-browser

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