How to detect iPad, Iphone using jQuery/javascript

Use below simple snippet of code to detect iPad.
<script type="text/javascript">
function chkiPad(){
return (navigator.platform.indexOf("iPad") != -1);
}
</script>
jQuery code for iphone / ipad / ipod detect:
<script type="text/javascript">
$(document).ready(function(){
var deviceAgent = navigator.userAgent.toLowerCase();
var agentID = deviceAgent.match(/(iphone|ipod|ipad)/);
if (agentID) {
// write your code
}
});
</script>

Comments

Popular posts from this blog

css :Custom Horizontal Rules

Hindi Toolkit