Try to search your question here, if you can't find : Ask Any Question Now ?

How to detect iPad Pro as iPad using javascript?

HomeCategory: stackoverflowHow to detect iPad Pro as iPad using javascript?
Avatarkundan asked 1 week ago

We were able to detect an iPad device using javascript like this:

function isDeviceiPad(){
    return navigator.platform.match(/iPad/i);
}

That worked perfectly in detecting iPad devices, but when we checked from an iPad Pro (10.5 inch), it does not detect that it is an iPad.

To further investigate, we drilled down into the navigator object, checked both platform and userAgent, and got these results:

navigator.platform = 'MacIntel';
navigator.userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) 
 AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Safari/605.1.15)';

The issue is that navigator.platform = 'MacIntel' (which is the same as the MacBook Pro) is returned instead of the iPad. We need a way to detect that this is an iPad and not a MacBook Pro, but it seems that the navigator does not return iPad like it does with older iPads.

Any idea how we can fix this issue?

1 Answers
Best Answer
AvatarMatthias answered 1 week ago
Your Answer

7 + 18 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com