bowser icon indicating copy to clipboard operation
bowser copied to clipboard

Short name 'edge' not working while full name 'Microsoft Edge' is

Open kevinhaas opened this issue 5 years ago • 2 comments

window.navigator.userAgent of the browser is:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299

And it's detected like:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299

However, the real name of the browser is: Microsoft Edge

I'm having an issue with the 'edge' short name, or perhaps I didn't understand the docs correctly.

With the above UA using [email protected] the following code evaluates to false when using latest Microsoft Edge:

Bowser.getParser(window.navigator.userAgent).is('edge')

While the following code evaluates to true under the same conditions:

Bowser.getParser(window.navigator.userAgent).is('Microsoft Edge')

I am using 'chrome', 'firefox' and 'ie' short names in the same manner with no issues.

Thanks!

kevinhaas avatar Jan 10 '20 20:01 kevinhaas

Hi, @kevinhaas! Thanks for the question and sorry for such a late answer. Having hectic times :D

Unfortunately, the Parser.is() method is not that flexible and doesn't reply to short names. Aliases work only with Parser.isBrowser() method: https://lancedikson.github.io/bowser/docs/Parser.html#isBrowser. I recommend using that one for now, and I think I'll fix the .is() method a bit later.

lancedikson avatar Jan 28 '20 20:01 lancedikson

@lancedikson is the PR mentioned above an acceptable way of supporting the use case reported?

It's pretty much what isBrowser does with the includingAlias param and it was done in a backward compatible way by setting the default to false. Let me know and I can update the PR as needed.

willamesoares avatar Aug 23 '20 19:08 willamesoares