javascript - detecting device and OS type using mobile detect js -


I am trying to use a device and OS identification script and have detected the JS plugin with this mobile . It seems that far enough clear.

And

It appears that the documentation is not completely and I am getting a little confused about how to make specific cases. For example, what I'm trying to do is to find out that the user is going to a website using a mobile or tablet and after that check is to find the device's OS in the next step.

  function DeviceDetectionScript () {var md = New MobileDetect (window.navigator.userAgent); If (MD.Mobile () and MD.phone () & amp; amp; MD.Tableable ()) {if (iOS) {/ some} if (Android) {// do something} if ( Window) {// do something}} other {// do something else}}   

However, I'm not sure that this is the right way to get it. Or is there any other way to get the same functionality without using this script?

For example, what I'm trying to do is to find out that the user Going to the website using mobile or tables and after that check is to find the device's OS in the next step.

Just FYI, the tablet is considered to be mobile.

You have a few options, which comes to your liking.

To check that the user is on mobile usage md.mobile) .

To determine whether this tablet or phone is use md.phone () and md.tablet () . It gives blank or brand name.

Finally the OS will use md.os () (this will print the name of the OS) or you md.is

  md .mobile () // 'Sony' md.phone () // 'Sony' MD.table () // null md.userAgent () // 'Safari' md.os () // 'AndroidOs' MD. ('IPhone') // wrong MD. ('Bot') // Wrong md.version ('Webkit') // 534.3 md.versionStr // '4.1.A.0.562' md.match ('playstation | xbox') // wrong < / Code>   

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -