Detect iPhone, iPad, iPod and Blackberry devices in Javascript

by Sasikumar 2014-08-01 22:33:18

We can detect iPhone, iPad, iPod and Blackberry devices in Javscript
We can use the following function to detect iPhone, iPod, iPad and Blackberry devices by getting the user agent of the device.
Javascript Function:
var myDeviceAgent = navigator.userAgent.toLowerCase();
var agentID = myDeviceAgent.match(/(iphone|ipod|ipad|blackberry)/);
if (agentID) 
{ 
    // device is  iphone or ipod or ipad or Blackberry 
}
else 
{ 
   // device doesnt belong to this category 
}
1633
like
0
dislike
0
mail
flag

You must LOGIN to add comments