<script src= "Http://cdn.bootcss.com/jquery/3.3.1/jquery.min.js" ></script><script src= "/http Cdnjs.cloudflare.com/ajax/libs/mobile-detect/1.4.1/mobile-detect.min.js "></script><script>//determines whether a string is contained in an arrayArray.prototype.contains =function(needle) { for(Iinch This) { if( This[I].indexof (needle) > 0) returni; } return-1; } varDevice_type = navigator.useragent;//Get useragent Information varMD =NewMobiledetect (Device_type);//Initialize Mobile-detect varOS = Md.os ();//Get System varModel = ""; if(OS = = "IOS") {//handling of iOS systemsOS = Md.os () + md.version ("IPhone"); Model=Md.mobile (); } Else if(OS = = "Androidos") {//processing of the Android systemOS = Md.os () + md.version ("Android"); varSSS = Device_type.split (";"); vari = Sss.contains ("build/"); if(I >-1) {model= sss[i].substring (0, Sss[i].indexof ("build/"))); } } Else{OS= ' non-mainstream OS '; Model= ' UnKnown '; } document.write (Operating system: "+ OS +" <br/> Model: "+ model");//Print to Page</script>
Open the page with your phone the results are as follows:
Reference: https://github.com/hgoebl/mobile-detect.js/
JavaScript access to mainstream phone systems and models