author: Krasimir Tsonev

Hi there, I'm . Senior front-end engineer with over 13 years of experience. I write, speak and occasionally code stuff.

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");
}
If you enjoy this post, share it on Twitter, Facebook or LinkedIn. Or maybe comment below: