comments 2

Detect IE Mobile with jQuery

There are multiple ways to detect IE Mobile with jQuery. A few methods to detect windows phone internet explorer with jQuery / JavaScript are with fiddle demo;

Method 01

Fiddle

if(navigator.userAgent.match(/iemobile/i)) 
{                                       
    alert('IE Mobile Detected');
}

Method 02

Fiddle

if (isIEMobile() === true) {
    alert('IE Mobile Detected');
}

function isIEMobile() {
    var regExp = new RegExp("IEMobile", "i");
    return navigator.userAgent.match(regExp);
}

Mobile Specific

Nokia Lumia or any Windows Phone browser has desktop and mobile browsing mode, IEMobile sends different user agent. Desktop mode does not send Windows Phone X.Y model argument. Find Windows+ARM+Touch+WPDesktop tags and possibly screen size to guess wphone or tablet.

Lumia 920 WPhone 8, Desktop mode
Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0; ARM; Touch; WPDesktop)

Lumia 920 Windows Phone 8
Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)

Lumia 820 Windows Phone 8
Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 820)

Lumia 800 Windows Phone 7.5
Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; NOKIA; Lumia 800)

Lumia 900
Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; NOKIA; Lumia 900)

WP7.5 IEMobile9 desktop mode
Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; XBLWP7; ZuneWP7)