Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kevinhaas opened this issue Jan 10, 2020 · 2 comments
Open

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

kevinhaas opened this issue Jan 10, 2020 · 2 comments
Labels

Comments

@kevinhaas
Copy link

kevinhaas commented Jan 10, 2020

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 bowser@2.8.1 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!

@lancedikson
Copy link
Collaborator

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.

@willamesoares
Copy link
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants