"Mozilla/5.0" and "like Gecko": Do web applications still test for Firefox-specific user agent strings?

0

Forgive me if this is the wrong site to ask this question; some similar questions were closed on Web Applications Stack Exchange, so I asked this question here. If necessary, feel free to migrate this question.


Many current browsers identify themselves with user agent strings containing Mozilla/5.0 or Gecko (as in like Gecko), which only make sense for Firefox (and later versions of Netscape Navigator).

Why is this still being used? If, say, Chrome (the latest version as of this writing, on Windows 8.1 64-bit) identified itself as

Chrome/32.0.1700.107 (Windows NT 6.3; WOW64) AppleWebKit/537.36

instead of

Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36

would some websites not work correctly on it? Are there still web applications that rely on these substrings in the user agent string?

For reference, the user agent string for Firefox 27 on Windows 8.1 64-bit is:

Mozilla/5.0 (Windows NT 6.3; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0

bwDraco

Posted 2014-02-12T20:50:09.413

Reputation: 41 701

Question was closed 2014-12-15T03:59:58.603

1I'd bet it's just legacy code; and I'd also bet that there are plenty of websites still using it, even though the common wisdom for a decade has been "don't sniff user agent strings!" – miken32 – 2014-02-12T20:58:55.660

Answers

0

Okay, I found the answer at Stack Overflow: Why do Chrome and IE put “Mozilla 5.0” in the User-Agent they send to the server? (credit goes to joatis)

This is basically a historical vestige retained for compatibility with certain (very) old websites. It turns out that in the old days, some websites would refuse to serve certain types of content (such as inline frames) to browsers with user agent strings that did not contain substrings like "Mozilla", including Internet Explorer at the time. Microsoft worked around this issue by posing as Mozilla:

Mozilla/1.22 (compatible; MSIE 2.0; Windows 95)

Everyone else ultimately followed suit, and the convention stuck. Even though it is considered bad practice today to serve different content based on the declared user agent string, some websites still rely on user agent sniffing to selectively serve content. (Heck, my personal website does a bit of UA sniffing to block known spambots!)

bwDraco

Posted 2014-02-12T20:50:09.413

Reputation: 41 701

0

I still think there are some web applications that use it, but I do not think it is particularly many who use it for anything.

I ask maybe a little silly, but what do you need the information for?.

MadsHaupt

Posted 2014-02-12T20:50:09.413

Reputation: 1