Method One: html+ packaged method, additional configuration, using the specified method of packaging is available
Property:
- IMEI: International mobile device identity code for the device
- IMSI: International Mobile Subscriber Identification code for devices
- Model: type of device
- Vendor: Manufacturer of equipment
- UUID: Unique identification of the device
Reference Address: http://www.html5plus.org/doc/zh_cn/device.html
Method Two: Refer to the plugin mobile-detect.js, you can get
- Console.log (Md.mobile ()); ' Sony '
- Console.log (Md.phone ()); ' Sony '
- Console.log (Md.tablet ()); Null
- Console.log (Md.useragent ()); ' Safari '
- Console.log (Md.os ()); ' Androidos '
- Console.log (md.is (' IPhone ')); False
- Console.log (md.is (' bot ')); False
- Console.log (md.version (' Webkit ')); 534.3
- Console.log (Md.versionstr (' Build ')); ' 4.1.a.0.562 '
- Console.log (Md.match (' Playstation|xbox ')); False
Reference Address: Http://hgoebl.github.io/mobile-detect.js
: https://github.com/hgoebl/mobile-detect.js/
Method Three: Call the app's native method, Jsbrage interactively get the JSON string
App interactive Var flag; var Jsbridge = (function () {function Connectwebviewjavascriptbridge (callback) {if (window. Webviewjavascriptbridge) {callback (Webviewjavascriptbridge); } else {Document.addeventlistener (' Webviewjavascriptbridgeready ', function () {Callback (We Bviewjavascriptbridge); }, False)}} Connectwebviewjavascriptbridge (function (Webviewjavascriptbridge) {Webviewjavas Criptbridge.init (function (message, responsecallback) {}); Webviewjavascriptbridge.registerhandler ("Contactslist", function (data, responsecallback) {phonenumbers= (data ); }); Webviewjavascriptbridge.registerhandler ("Contacts", function (data, responsecallback) {var datas=json.parse (d ATA); if (currentnum==1) {name1=datas.name; Tel1=datas.phone; $ ("#firstTxtName"). Val (datas.naME); $ ("#firstTxtTel"). Val (Datas.phone); }else {name2=datas.name; Tel2=datas.phone; $ ("#secondTxtName"). Val (Datas.name); $ ("#secondTxtTel"). Val (Datas.phone); } }); Webviewjavascriptbridge.callhandler (' Getappversion ', {}, Function (response) {callback (response);}); fn && fn (); }) return {init:function (fn) {Connectwebviewjavascriptbridge (function (Webviewjavascriptbri DGE) {webviewjavascriptbridge.init (function (message, responsecallback) {}); fn && fn (); })}, Copywechat:function (obj) {webviewjavascriptbridge.callhandler (' copywechat ', {page ID:obj.pageID}, function (response) {}); }, Saveqr:function (obj) {webviewjavascriptbridge.callhandler (' saveqr ', {pageid:obj. PageID}, function (response) {}); }, Showapppage:function (obj) {webviewjavascriptbridge.callhandler (' showapppage ', {PAGEID:OBJ.PA Geid}, function (response) {}); }, Jumpto:function (obj) {webviewjavascriptbridge.callhandler (' Jumpto ', {}, Function (response) { }); }, Showwebpage:function (obj) {webviewjavascriptbridge.callhandler (' showwebpage ', {title:obj.title, PAGEURL:OBJ.PAGEURL}, function (response) {}); }, Getsid:function (callback) {Webviewjavascriptbridge.callhandler (' GetSID ', {}, function (respons E) {callback (response);}); }, Getcontacts:function (callback) {Webviewjavascriptbridge.callhandler (' getcontacts ', {}, Function (response) {callback (response);}); }, Getappversion:function (callback) {Webviewjavascriptbridge.callhandler (' getappversion ', {}, Function (resPonse) {flag=response; Callback (response); }); } } })();
JS Get mobile device information (Imem,imis, phone model, system version, browser information, etc.)