Monday 26 December 2011

script detect iPhone and iPod browsers

Add this JavaScript code to detect  iPhone & iPod.
 
 if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
  //code
}
 
Jquery :
 
jQuery(document).ready(function($){
    var deviceAgent = navigator.userAgent.toLowerCase();
    var agentID = deviceAgent.match(/(iphone|ipod|ipad)/);
    if (agentID) {
        // code here
    }
});
 

No comments:

Post a Comment