Is there a way to detect if the current user is using an iPad using jQuery/JavaScript?
Javascript – Detect iPad users using jQuery
browser-detectionipadjavascriptjquery
Related Topic
- Javascript – var functionName = function() {} vs function functionName() {}
- Javascript – Which equals operator (== vs ===) should be used in JavaScript comparisons
- Javascript – How to redirect to another webpage
- Javascript – How to insert an item into an array at a specific index (JavaScript)
- Javascript – How to check whether a checkbox is checked in jQuery
- Javascript – What does “use strict” do in JavaScript, and what is the reasoning behind it
- Javascript – the best way to detect a mobile device
- Javascript – How to remove a specific item from an array
Best Answer
iPad Detection
You should be able to detect an iPad user by taking a look at the
userAgent
property:iPhone/iPod Detection
Similarly, the
platform
property to check for devices like iPhones or iPods:Notes
While it works, you should generally avoid performing browser-specific detection as it can often be unreliable (and can be spoofed). It's preferred to use actual feature-detection in most cases, which can be done through a library like Modernizr.
As pointed out in Brennen's answer, issues can arise when performing this detection within the Facebook app. Please see his answer for handling this scenario.
Related Resources