Skip to main content
Version: 2.0.3

is.edge

is.edge(target: unknown)โ€‹

The is.edge method is a function that takes a user agent string as input and returns true if the user agent corresponds to the Microsoft Edge browser, and false otherwise.

Determines whether the given user agent string corresponds to the Microsoft Edge browser. Returns true if the user agent string corresponds to Edge, and false otherwise.

Note that the userAgent parameter is optional; if not provided, the function will default to using navigator.userAgent.

Specificationโ€‹

  • Target argument: optional.
  • Return: boolean.

Informationโ€‹

  • Unit tests: โœ…

Examplesโ€‹

is.edge() // true if the command is executed in the edge browser
is.edge('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36 Edg/93.0.961.38') // true

// Alternative
isConfig.state.userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36 Edg/93.0.961.38';
is.edge() // true

// Recomendation
is.browser_edge();

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

Reversal boolean resultโ€‹

is.not_edge() // false if the command is executed in the edge browser
is.not_edge('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36 Edg/93.0.961.38') // false

// Alternative
isConfig.state.userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36 Edg/93.0.961.38';
is.not_edge() // false

// Recomendation
is.not_browser_edge();

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