mdn / content

The content behind MDN Web Docs
https://developer.mozilla.org
Other
9.15k stars 22.46k forks source link

Expand detection conditions for Chrome to not confuse it with Edge #2968

Closed RomViR closed 1 year ago

RomViR commented 3 years ago

MDN URL: https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent

What information was incorrect, unhelpful, or incomplete?

Per https://docs.microsoft.com/en-us/microsoft-edge/web-platform/user-agent-string Edge user agent string also matches conditions "must contain Chrome/XYZ and must not contain Chromium/XYZ"

Specific section or headline?

Table in section https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#browser_name

What did you expect to see?

For Chrome rules can be expanded to also not match string "Edg/XYZ"

Did you test this? If so, how?

Yes. Fire up latest desktop Edge via lambdatest.com and check navigator.userAgent via dev tools

MDN Content page report details * Folder: `en-us/web/http/browser_detection_using_the_user_agent` * MDN URL: https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent * GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/http/browser_detection_using_the_user_agent/index.html * Last commit: https://github.com/mdn/content/commit/f6f11d2a249520f01bad93d7c4a5e5cdf6ed914a * Document last modified: 2021-02-19T19:33:30.000Z
RomViR commented 3 years ago

For Chrome rules can be expanded to also not match string "Edg/XYZ"

Scratch that! Edge on different platforms has different browser name https://www.whatismybrowser.com/guides/the-latest-user-agent/edge

Seems like the best way to exclude Edge would be to search for "Edg".