Created
June 25, 2013 17:27
-
-
Save nukecpower/5860452 to your computer and use it in GitHub Desktop.
Detect Apple Devices (iPad, iPhone, iPod) using jQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
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. | |
} | |
}); | |
function isAppleDevice(){ | |
return ( | |
(navigator.userAgent.toLowerCase().indexOf("ipad") > -1) || | |
(navigator.userAgent.toLowerCase().indexOf("iphone") > -1) || | |
(navigator.userAgent.toLowerCase().indexOf("ipod") > -1) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment