Detect Apple Devices (iPad, iPhone, iPod) using jQuery

iPhone/iPad development is pretty hot and very much in demand. Below small piece of code will be useful to detect apple devices like iPhone, iPad and iPod using jQuery.

Related Post:
  var isiPhone = navigator.userAgent.toLowerCase().indexOf("iphone");
  var isiPad = navigator.userAgent.toLowerCase().indexOf("ipad");
  var isiPod = navigator.userAgent.toLowerCase().indexOf("ipod");

  if(isiPhone > -1)
      //Redirect to iPhone Version of the website.
  if(isiPad > -1)
      //Redirect to iPad Version of the website.
  if(isiPod > -1)
      //Redirect to iPod Version of the website.
You can test this code by changing the user agent in your browser and set it to iPhone, iPad or iPod. There are many plugins/ extension available that allows to change User agent. Below is the link for various user agent switchers available with chrome and firefox.

If you just want to detect whether the device used is one of out of these 3 then you can create a function which will return true, if the devices is one of them otherwise false.
function isAppleDevice(){
    return (
        (navigator.userAgent.toLowerCase().indexOf("ipad") > -1) ||
        (navigator.userAgent.toLowerCase().indexOf("iphone") > -1) ||
        (navigator.userAgent.toLowerCase().indexOf("ipod") > -1)
Feel free to contact me for any help related to jQuery, I will gladly help you.

Nothing shocks me, I'm a Software Engineer. And I am not young enough to know everything. I live in World Wide Web and from there take care of this website. This website communicates about my work, learning and experience. I believe life is short, and it is for loving, sharing, learning and connecting. So lets connect..