iPhone and iPod detection under JavaScript

Blog / 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"); }


Krasimir Tsonev With over two decades of deep programming expertise, I offer comprehensive web consultancy and stack audits, alongside specialized workshops, training, and engaging public speaking to elevate your team's skills and optimize your digital presence. Contact me.

Keywords: iphone ipod navigator useragent match
Share the post on Twitter, Facebook, LinkedIn