Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iPad Air and iPad Pro - type not correctly identified #690

Open
dann2g opened this issue Nov 16, 2023 · 7 comments
Open

iPad Air and iPad Pro - type not correctly identified #690

dann2g opened this issue Nov 16, 2023 · 7 comments

Comments

@dann2g
Copy link

dann2g commented Nov 16, 2023

Library version
v1.0.37

Describe the bug
iPad Pro and iPad Air user agents from Chrome Dev Tools are not recognized as tablets. Mentioning Chrome Dev Tools here as I can't rule out Chrome using incorrect user agents.

To Reproduce
Steps to reproduce the behavior:

  1. Open Chrome Dev Tools --> Device Toolbar
  2. Select iPad Air or iPad Pro from list
  3. Visit webpage that uses ua-parser-js
  4. device is returned as { vendor: 'Apple', model: 'Macintosh', type: undefined }

Alternatively use one of these user agents which is what my Chrome (Version 119.0.6045.124) is using:

  • iPad Air - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15
  • iPad Pro - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15

Expected behavior
device returned as { vendor: 'Apple', model: 'iPad', type: 'tablet' }

@rickson-simoes
Copy link

rickson-simoes commented Nov 21, 2023

If you use getOS function through the ipads, what is returned inside { name } of both of them?

@FelixK-Witt
Copy link

Hi @rickson-simoes, in both cases I get {name: 'Mac OS', version: '10.15.7'} with the getOS function. I guess this should be iOS instead. Selecting "IPad Mini" in the browser returns {name: 'iOS', version: '16.6'} for example.

@jemil-neuffer
Copy link

jemil-neuffer commented Nov 27, 2023

I am facing same issue, it cannot detect Ipad with latest iOS 17, i am getting - { vendor: 'Apple', model: 'Macintosh', type: undefined }. Apple updated userAgent for iPad - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1.1 Safari/604.1 - this from real iPad Safari using latest iOS 17. So there is no iPad anymore in useragent. Has anyone found how to detect iPad ?

@faisalman
Copy link
Owner

Since Apple froze its user agent in version 10.15.7, we haven't yet find a reliable solution that can be derived from only the user agent data (as in the Chrome Dev Tools case). However, if we are using a real browser in iPad we can try to do an additional check for iPad-specific browser features:

const uap = new UAParser();
const device1 = uap.getDevice();
const device2 = uap.getDevice().withFeatureCheck();

console.log(device1); // { vendor : "Apple", model : "Macintosh", type : undefined }
console.log(device2); // { vendor : "Apple", model : "iPad", type : "tablet" }

@aradalvand
Copy link

aradalvand commented Dec 8, 2023

@faisalman Thanks for the workaround. Small question: Does calling .withFeatureCheck() also correct browser.name? Namely, update it from Safari to Mobile Safari?

@kofifus
Copy link

kofifus commented May 3, 2024

Hi @faisalman what are valid values for model when using uap.getDevice().withFeatureCheck() ? will it detect iPhone ?

@xiaoyang678
Copy link

Since Apple froze its user agent in version 10.15.7, we haven't yet find a reliable solution that can be derived from only the user agent data (as in the Chrome Dev Tools case). However, if we are using a real browser in iPad we can try to do an additional check for iPad-specific browser features:由于Apple在10.15.7版本中冻结了其用户代理,我们还没有找到一个可靠的解决方案,可以只从用户代理数据(如Chrome Dev Tools案例)中导出。但是,如果我们在iPad中使用真实的浏览器,我们可以尝试对iPad特定的浏览器功能进行额外检查:

const uap = new UAParser();
const device1 = uap.getDevice();
const device2 = uap.getDevice().withFeatureCheck();

console.log(device1); // { vendor : "Apple", model : "Macintosh", type : undefined }
console.log(device2); // { vendor : "Apple", model : "iPad", type : "tablet" }

https://docs.uaparser.dev/api/ua-parser-js/idata/with-feature-check.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants