简体   繁体   中英

What information can I get from the android browser JavaScript?

I know I can get screen width/height in a browser, can I get any other information about the device? Device name, OS, carrier, etc?

It seems as though the only additional resources you're provided with have to do with screen density and resolution: http://developer.android.com/guide/webapps/index.html . However, if you are going to display this page in a WebView , you can utilize the Java-Javascript bridge to access any information available to the standard Java API (or non standard if you want to get creative and use reflection ;-) )

Edit: Oops, didn't see you meant from the browser javascript >< disregard information below.

android.os.Build provides a lot of information. Try:

String s="Debug-infos:";
s += "\n OS Version: " + System.getProperty("os.version") + "(" + android.os.Build.VERSION.INCREMENTAL + ")";
s += "\n OS API Level: " + android.os.Build.VERSION.SDK;
s += "\n Device: " + android.os.Build.DEVICE;
s += "\n Model (and Product): " + android.os.Build.MODEL + " ("+ android.os.Build.PRODUCT + ")";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM