I can check for iPhone with this code:
(navigator.userAgent.match(/iPhone/i))
But I want to target Windows Phone with this userAgent:
Mozilla/4.0(compatible; MSIE 6.0; Windows NT 5.1;
Motorola_ES405B_19103; Windows Phone 6.5.3.5)
Is there any way to do this?
Windows Phonecertainly seems to be the term you want to match. So just exchangeiPhonein your matcher with that term and you’re good to go!As mentioned in the comments: looking also for
iemobilewill give you an even broader range of detected microsoft mobiles OSes.e.g.: