How to check weather the device is iPad and tablet in phonegap

前端 未结 3 2011
生来不讨喜
生来不讨喜 2020-12-20 02:25

How to check device in phonegap?.Actually i need that my application is only run only tablet or in Iphone .I need to block my application on other phones only run Android ta

3条回答
  •  有刺的猬
    2020-12-20 02:58

    You can do it with JavaScript, using User Agent as already explain in another answer,

    But you could also use the Cordova/PhoneGap Device API

    http://cordova.apache.org/docs/en/2.8.0/cordova_device_device.model.md.html#device.model

    Using var string = device.model;

    string will contain the iOS model

    Giving you all the information from the native just in case you want to know if its an iPad 1, iPad 2, or iPad Mini

    For example "iPad2,5" is the iPad Mini Wifi

    Check out this website for mapping information http://theiphonewiki.com/wiki/Models

提交回复
热议问题