Skip to main content
Version: 2.0.3

is.windowsPhone

is.windowsPhone(target: unknown)โ€‹

The is.windowsPhone method is a part of the is library that is used to determine whether the current device is a Windows Phone.

Specificationโ€‹

  • Target argument: optional.
  • Return: boolean.

Informationโ€‹

  • Unit tests: โœ…

Examplesโ€‹

is.windowsPhone() // true if the command is executed in a browser running on the windows phone
is.windowsPhone('Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 635) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537') // true

// Alternative
IsConfig.state.userAgent = 'Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 635) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537';
is.windowsPhone() // true

is.windowsPhone(769) // false
is.windowsPhone(false) // false
is.windowsPhone(new Boolean(0)) // false
is.windowsPhone(new Boolean()) // false
is.windowsPhone(0) // false
is.windowsPhone('') // false
is.windowsPhone({}) // false
is.windowsPhone([]) // false
// And all other known types will return false

Reversal boolean resultโ€‹

is.not_windowsPhone() // false if the command is executed in a browser running on the iPhone
is.not_windowsPhone('Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1') // false

// Alternative
IsConfig.state.userAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1';
is.not_windowsPhone() // false

is.not_windowsPhone(769) // true
is.not_windowsPhone(false) // true
is.not_windowsPhone(new Boolean(0)) // true
is.not_windowsPhone(new Boolean()) // true
is.not_windowsPhone(0) // true
is.not_windowsPhone('') // true
is.not_windowsPhone({}) // true
is.not_windowsPhone([]) // true
// And all other known types will return true