Skip to main content
Version: 1.0.1

is.android-phone

is.androidPhone(target: unknown)​

Specification​

  • Target argument: optional.
  • Return: boolean.

Data used for examples

const userAgent = 'Mozilla/5.0 (Linux; Android 11; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Mobile Safari/537.36';

Examples​

is.androidPhone() // true if the command is executed in a browser running on the androidPhone
is.androidPhone(userAgent) // true

// Alternative
IsConfig.state.userAgent = userAgent;
is.androidPhone() // true

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

Reversal boolean result​

is.not.androidPhone() // false if the command is executed in a browser running on the androidPhone
is.not.androidPhone(userAgent) // false

// Alternative
IsConfig.state.userAgent = userAgent;
is.not.androidPhone() // false

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