JS Get mobile device information (Imem,imis, phone model, system version, browser information, etc.)

Source: Internet
Author: User

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

  1. Console.log (Md.mobile ()); ' Sony '
  2. Console.log (Md.phone ()); ' Sony '
  3. Console.log (Md.tablet ()); Null
  4. Console.log (Md.useragent ()); ' Safari '
  5. Console.log (Md.os ()); ' Androidos '
  6. Console.log (md.is (' IPhone ')); False
  7. Console.log (md.is (' bot ')); False
  8. Console.log (md.version (' Webkit ')); 534.3
  9. Console.log (Md.versionstr (' Build ')); ' 4.1.a.0.562 '
  10. 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.)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.