iPhone and iPod detection under JavaScript
A little code snippet for detecting iPhone or iPod. You can easily edit it to match iPad.
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) { console.log("iphone"); }
Check out "Do you speak JavaScript?" - my latest video course on advanced JavaScript.
Language APIs, Popular Concepts, Design Patterns, Advanced Techniques In the Browser
A little code snippet for detecting iPhone or iPod. You can easily edit it to match iPad.
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) { console.log("iphone"); }