My 5th book "50 Tips on JavaScript" is on sale. Go get it from https://50tips.dev.
Illustrated guide to 50 of the most interesting JavaScript topics.

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. To leave a comment go here.