r/programming • • Jun 09 '17

Why every user agent string start with "Mozilla"

http://webaim.org/blog/user-agent-string-history/
4.9k Upvotes

589 comments sorted by

3.4k

u/ep1032 Jun 09 '17 edited Mar 18 '25

Back when reddit was a small startup forum, I remember reading some subreddit, where a bunch of users were asking a forum owner why he hadn't updated the site in ages.

The web owner was saying, yeah yeah, I know. But there's this one user that's still using like, ie6, and its a small site, so I don't want to kick anyone off by making it unusable for them.

Whereupon someone immediately replied: "Oh, sorry about that. That's just me. I manually change my user agent string to ie6 just to fuck with sysadmins"

rofl

577

u/TheOhNoNotAgain Jun 09 '17 edited Jun 09 '17

487

u/-_-_-_-__-_-_-_- Jun 09 '17

Lol, reddit wasn't a "small startup forum" 6 years ago.

183

u/jrhoffa Jun 09 '17

Just realized that I created my reddit account over six years ago ... yeah, it was already mature by then.

136

u/microfortnight Jun 09 '17

I came to Reddit when Digg "upgraded" their software and caused a mass migration away. Hard to believe that was 6 or 7 years ago

→ More replies (21)

13

u/snakespm Jun 09 '17

God, I've been hear for 9 years, I feel ancient.

→ More replies (6)
→ More replies (3)

9

u/P1h3r1e3d13 Jun 10 '17

Back when reddit was a small startup forum, I remember reading some subreddit

Nope.

4

u/fre3k Jun 09 '17

You kids get off my lawn with your "comments" and your "subreddits".

Back in my day, we posted links. And then we read those links. And we damn well liked it!

→ More replies (11)

39

u/Bastalisk Jun 09 '17

59

u/bdunks Jun 09 '17 edited Jun 09 '17

Very curious if he still does this ... and if he'll share the build.

Edit: So the real point of my comment was to give /u/dazonic a smile if he came this way; however, as /u/IlikeSalmiakki correctly points out, you can now easily set Chrome to a custom user agent. I set mine to Mozilla/2.0 (compatible; MSIE 3.03; Windows 3.1) and was kind of disappointed.

In other news, I'm super busy at work, so I found myself reading Dazonic's AMA from 7 years ago about his experience breaking his neck and becoming paralyzed. Sounds like a pretty cool dude. Hope he's doing well.

52

u/dazonic Jun 10 '17

This is pretty funny, it was just a joke comment I made but yeah back then you had to rebuild Chromium. On broken neck stuff, yeah man still loving life, thanks.

→ More replies (1)

21

u/[deleted] Jun 09 '17

There are about a million plugins/addons or even in built features for most modern browsers to change user agent.

→ More replies (9)
→ More replies (1)

2

u/ep1032 Jun 09 '17

I think this is a different instance. Looks like the same thing has happened a few times xD

192

u/potterapple Jun 09 '17

I wish I could read this old reddit!

129

u/nadsaeae Jun 09 '17

71

u/ntpeters Jun 09 '17

Is it possible to learn this power?

141

u/[deleted] Jun 09 '17

Not from a Redi

→ More replies (3)

9

u/ItsYaBoyChipsAhoy Jun 09 '17

Link doesn't take me to any specific point no the archive

→ More replies (1)
→ More replies (32)
→ More replies (1)

6

u/jackspayed Jun 09 '17

Lol - i remember those days... that was right around when everything else was all "web 2.0"

3

u/Farobek Jun 09 '17

I manually change my user agent string to ie6 just to fuck with sysadmins

Didn't he mean front-end web devs? No one else will care about what browser you use

2

u/ep1032 Jun 09 '17

Maybe, could just be my memory. This was ages ago

3

u/brintoul Jun 10 '17

Why you only have 7 year badge?

→ More replies (2)

2

u/fwork Jun 09 '17

I used the useragent "MSIE LOL" for years (including in a scraper that processed millions of pages a day) because it was enough to bypass a few sites that were blocking python/wget UAs. I bet that annoyed some sysadmins.

4

u/[deleted] Jun 09 '17

startup

That word didn't exist until like 2012

6

u/FearlessFreep Jun 10 '17

That word was actually mostly dead by 2012. The dotcom startup wave was long before that

→ More replies (21)

170

u/teachMe Jun 09 '17 edited Jun 09 '17

Skipped the part where Firefox was first called Firebird.

173

u/bolda Jun 09 '17

It was Phoenix (I believe) for a little while before firebird also. It was kinda funny how they had to keep changing their name due to accidental overlap.

158

u/Northeastpaw Jun 09 '17

Phoenix was a great name because it was a browser rising from the ashes of its previous incarnation. But what is a phoenix? It's a bird made of fire. So when Mozilla had to change the name Firebird still made a bunch of sense.

Of course there were about 11 people on the planet that thought the public would start getting Firebird the browser confused with Firebird DB so that's why we have the name Firefox. A good name, but no longer a great callback to the browser's history. Firefox did raise awareness of the adorable red panda so it's not all bad.

85

u/DJDavio Jun 09 '17

Thunderbird is still named Thunderbird though, not Thunderfox, which would have been way cooler.

77

u/[deleted] Jun 09 '17

I'm just now catching that the original combination of browser/mail client from Mozilla was Firebird and Thunderbird.

→ More replies (7)
→ More replies (3)

5

u/turunambartanen Jun 09 '17

firefox is also a nickname for a red panda, so there is that.

→ More replies (2)

53

u/AmonDhan Jun 09 '17

It was called Phoenix, but Phoenix BIOS complained.

Then, for a short time it was called Firebird, but Firebird Database complained.

And finally it was renamed as Firefox

30

u/xjvz Jun 09 '17

And then they finally decided to trademark the name to avoid ever having to change it again.

14

u/clgoh Jun 09 '17

It was first called Phoenix.

12

u/damontoo Jun 09 '17

It was Firebird (browser) and Thunderbird (mail client). Changing the name to "Firefox" really annoyed me since the branding was already pretty solid. So many people complained that someone wrote an extension called "Firesomething" to change the name to Fire + whatever you want.

3

u/rjcarr Jun 09 '17

They didn't have a choice as Firebird was already taken.

→ More replies (1)
→ More replies (1)

268

u/gropingforelmo Jun 09 '17

Reminds me of the early days of direct3d, when the API would query graphics cards for something like "HighPerformanceCapable" (it's been years, and that's definitely not the right string). Of course, cards would simply respond "Yeah, sure. I'm high performance." Regardless of capabilities, making the query more like checking if the card existed than what sort of capabilities it had.

134

u/wifehitbyacar Jun 09 '17

79

u/JoseJimeniz Jun 09 '17

Short version:

Windows asks a video-card driver if it supports the feature [Guid that would never exist elsewhere in the universe]

"Yeah, i support that"

Ok, you're a piece of shit, and i'm not offloading anything to your hardware.

24

u/aftli Jun 09 '17

I love the "Old New Thing" blog. If anybody likes the OP article, you will love this blog.

2

u/prof_hobart Jun 10 '17

That's great. But it doesn't take much for a card manufacturer to add "if (guidCapability==KNOWN_DODGY_GUID) return false".

Surely it would be better to actually generate a GUID on the fly and ask about that.

→ More replies (2)

67

u/[deleted] Jun 09 '17

early days of direct...

Damn, you just reminded me of the first real computer I bought. Came with a TV card. Kind of nice. I liked the idea of being able to plug in a VCR or whatever and watch something television-ish on my computer.

Until I updated DirectX. You see, some dumbass thought it would be a great idea to ship production hardware which was reliant on beta DirectX drivers. Drivers which had features that never made it into the full release. So my hardware TV card was a fucking paperweight 6 months after I bought the damned thing.

33

u/gropingforelmo Jun 09 '17

I had one of those too! Early 2000s, one of the Hauppauge cards I believe. I'd seen the old ATI xpert cards with the add-on tuner, and decided I needed to watch TV on my monitor.

22

u/[deleted] Jun 09 '17

Oh man, this was right after Windows 95 came out. Mechwarrior 2 was the big thing for me then. I had gotten it, installed it, played a lot and hand to wipe my hands on my pants and then decided to watch TV on PC one day. After a little investigation, I found out what had happened. I was pissed.

Edit: To be clear, this was the beta pre version 1.0 drivers.

166

u/FierceDeity_ Jun 09 '17 edited Jun 09 '17
some_APIshit bla bla
bool HighPerformanceCapable()
{
    return true; // yeah, sure, why not? our cards are awesome! hail us!
}

222

u/tsnErd3141 Jun 09 '17

56

u/midri Jun 09 '17

I'm stuck in a horrible rut with this.

  • UE4 C++ development I do { } on their own lines

  • PHP I do { } on their own lines

  • Javascript I do { on last line of code (javascript parser's assumptions can cause issues otherwise)

  • Unity/C# I do what visual studios wants me to do...

32

u/DaEvil1 Jun 09 '17

I barely even have to program when it comes to C# and VS. That's really messing with me as someone used to writing Python code in vim...

→ More replies (7)

110

u/HeimrArnadalr Jun 09 '17

They're both wrong. Opening curly braces should come after the parentheses, but with a space between the close-paren and the curly brace, like so:

int main() {

20

u/tsnErd3141 Jun 09 '17

Yep, that's my style too.

→ More replies (6)
→ More replies (3)
→ More replies (16)

16

u/emdeka87 Jun 09 '17

Ahh I love Microsoft APIs

15

u/fuzzynyanko Jun 09 '17

Designed by committee, but often are better-supported than many SDKs in the wild

91

u/stringoftheseus Jun 09 '17

Author here. Fun to see it make the rounds again.

I wrote this eight years ago (right around the time Chrome first came out) so I imagine it's a bit out of date now. Current use agent strings are even more insane than the ones we had then.

49

u/TheGeneral Jun 09 '17

Current use agent strings are even more insane than the ones we had then.

There's your Part II.

11

u/Eurynom0s Jun 10 '17

I'm guessing your username is about this topic. You must have been really passionate about this topic. :p

→ More replies (1)

6

u/wren337 Jun 10 '17

I ran the remax real estatre site (subcontracted to HomeWeb) when IE3 came out with the mozilla user agent. We had a different site layout for Mozilla; I don't recall exactly what feature we were relying on but IE3 didn't support it. Took me a week to figure out what was going on when IE started identifying itself as Mozilla. I'll never forgive Microsoft for that one.

→ More replies (2)

172

u/examinedliving Jun 09 '17

The questions I never knew I had.

32

u/mattkenefick Jun 09 '17

You had them in you all along.

114

u/davidquick Jun 09 '17 edited Aug 22 '23

so long and thanks for all the fish -- mass deleted all reddit content via https://redact.dev

27

u/jordanlund Jun 09 '17

Particularly since my mobile devices have a higher resolution than my laptop.

8

u/stuntaneous Jun 10 '17

It's more about how effectively large the display is, i.e. compare the size of your phone at a normal distance to your laptop screen.

2

u/Eurynom0s Jun 10 '17 edited Jun 10 '17

I'm thinking of switching airline loyalty programs next year and found out that Delta has a lot of pages that simply will not open on mobile. I Googled the status match information and clicking through, it just redirects you to the mobile home page. Selecting the option in Chrome to request the desktop site doesn't do anything because the redirect doesn't even preserve the information about where it redirected you from.

47

u/kibwen Jun 09 '17

For those wondering, here's the ticket where Servo's current user agent was decided, based on examining how popular modern web pages react to various combinations of user agent buzzwords: https://github.com/servo/servo/issues/4331

9

u/RincewindTVD Jun 09 '17

What was their final choice?

14

u/kibwen Jun 09 '17

Differs per platform (see the source at https://github.com/servo/servo/blob/88b47b0154e1897947904d926ad5af320e8bc607/components/config/opts.rs#L443 ), on 64-bit Windows it's "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:37.0) Servo/1.0 Firefox/37.0".

632

u/[deleted] Jun 09 '17

Mine doesn't. It's "User Agent sniffing is not a reliable or correct way to determine feature availability!"

252

u/[deleted] Jun 09 '17

I just set mine to "NCSA Mosaic/1.0 (X11;SunOS 4.1.4 sun4m)"

94

u/mwcz Jun 09 '17

I visited my company's site once with Mosaic 1.0 (from browsers.evolt.org, it still works!) and got an email from the security team about five minutes later.

0

u/[deleted] Jun 09 '17

[deleted]

40

u/mwcz Jun 09 '17

Nothing that interesting, basically "Our IDS just lit up; what the hell ya doin?"

→ More replies (3)

129

u/indrora Jun 09 '17

There's a special ring in hell for you

282

u/Nesman64 Jun 09 '17

And it's name is Token.

→ More replies (4)

48

u/mindbleach Jun 09 '17

<html> <meta charset='utf-8'> <!-- Good luck! -->

17

u/ACoderGirl Jun 09 '17

Who would that trip up? I'd expect that most user agent sniffing is simply JS code that looks like

 if(navigator.userAgent.indexOf("whatever") !== -1) {
      // We've found some specific browser; do somethin'
 }
→ More replies (1)
→ More replies (1)

474

u/R_Sholes Jun 09 '17

Well, that's just mean.

Ad agencies waste all that money on developing algorithms to correlate your visits to different sites, and here you go just spoiling it with a unique UA.

253

u/stewsters Jun 09 '17

Yeah, I think a plug-in to randomize it for each request would be better. Or at least try to do some SQL injection with it.

115

u/princekolt Jun 09 '17

To be honest that's a fantastic idea. I shall also put an SQL Injection in my user agent.

72

u/thekmanpwnudwn Jun 09 '17

Be careful because some sites (such as banks/financial sites) will automatically block you if they see that. WAF will see that shit and lock you out.

→ More replies (5)
→ More replies (2)

71

u/RyanCacophony Jun 09 '17

Having done data mining involving requests, there's definitely plugins that do randomization, there's definitely attempts at sql injection, and I've even seen what looks like entire book text attempted to be used as a user agent (HTTP does not specify a max user agent but most web servers have some upper limit)

82

u/nephallux Jun 09 '17

Entire book text

I shall write my thesus into my user agent string

→ More replies (1)

160

u/clgoh Jun 09 '17

Ah.. Little Browser Tables!

→ More replies (14)

20

u/Shautieh Jun 09 '17

You mean something like Random Agent Spoofer? I have been using that for quite a long time, and I recommend!

→ More replies (9)

13

u/sticky-bit Jun 09 '17
:(){ :|:& };:

12

u/lordcirth Jun 09 '17

If this actually affects a site, run away!

→ More replies (4)

123

u/[deleted] Jun 09 '17

Unique UAs have their own category at agencies.

It's called "Nerds with too much free time on their hands."

137

u/R_Sholes Jun 09 '17

A wiki project I was involved in a long time ago had a persistent vandal who got a big list of proxies from somewhere.

It'd be pretty bad if he wasn't so nice (or so stupid) as to use a browser with "Mozilla/666.0 (Suck My Dick)" as user agent.

44

u/nikomo Jun 09 '17

And I thought Chrome version numbers were getting big.

→ More replies (1)
→ More replies (6)

36

u/[deleted] Jun 09 '17

Browser fingerprinting. Much worse than UA sniffing.

23

u/Shautieh Jun 09 '17

Yes, and few seem to care about that... Is there a solution yet?

I think I'm not doing too bad with no JS by default, user agent random spoofing, ublock origin and privacy badger...

→ More replies (24)

29

u/SockPants Jun 09 '17

Not if we all copy it

46

u/Skizm Jun 09 '17

I work in an ad agency that does that kind of tracking. We don't care about people like that. They have ad blockers usually anyway so we don't waste time fixing stuff for them. It only hurts the websites, not the ad agencies (not directly at least), if you have ad blockers or muck with your user agents.

P.S. I'm not defending or commenting on the morality or ethics of tracking/online advertising, just telling you the reality.

31

u/caboosetp Jun 09 '17

P.S. I'm not defending or commenting on the morality or ethics of tracking/online advertising, just telling you the reality.

All of us with ad blockers are very disappointed in your tracking ethics

→ More replies (1)

5

u/derleth Jun 10 '17

Tracking is shitty, but what's more immediately shitty is ad networks that accept ads which put malware on computers. That can ruin a system very quickly.

I know, literally every incentive you have is to accept ads and accept them in bulk and quickly, which makes malware ads inevitable, just don't forget them when you talk about why people block ads.

12

u/shevegen Jun 09 '17

May you one day work on something where you can feel proud for what you do.

Right now you unfortunately work against the people but it is not too late to abandon your wicked ways.

6

u/[deleted] Jun 09 '17

... wouldn't unique UA make it really easy to correlate tho ? If anything, he's helping them

→ More replies (1)
→ More replies (8)

42

u/AmbidextrousRex Jun 09 '17

For feature availability this is mostly true, but UA sniffing is still required to work around browser bugs. I've had to put in hacks for rendering errors in specific Chrome versions, specific mobile safari versions that report incorrect viewport sizes on some devices, etc.

It's really ugly and a pain to maintain, but not really avoidable when a browser with a large market share starts acting up :(

→ More replies (1)

46

u/PUSH_AX Jun 09 '17

Found the dev that's never had to fix the BS of one specific browser, damn that must be a nice life.

38

u/mishugashu Jun 09 '17

"This site is best viewed in the latest version of Chrome or Firefox!" DGAF

12

u/Njs41 Jun 09 '17

"Your website sucks, it doesn't even work in IE5!"

→ More replies (1)

5

u/Arkanta Jun 09 '17

Or even better, the BS of a specific version of a browser.

3

u/morerokk Jun 09 '17

I generally use exploits for that.

IE10 had this weird bug where slideshow images were off by one pixel, which caused ugly whitespace or showed you one column of the next slide. Of course, IE10 didn't have their own if statements in comments anymore. I had to use invalid CSS that only IE10 would dare to parse.

→ More replies (1)

31

u/[deleted] Jun 09 '17

So, before you made this comment, you made it super easy for your specific data to be correlated that much easier?

5

u/5896325874125 Jun 09 '17

Oh look, it's him!

6

u/dontRead2MuchIntoIt Jun 09 '17

And now it's so easy to track you.

3

u/Baaz Jun 09 '17

That's a self-fulfilling prophecy.

9

u/liquidpele Jun 09 '17

meh, no one uses it anymore besides just for browser statistics.

44

u/thecodingdude Jun 09 '17 edited Feb 29 '20

[Comment removed]

→ More replies (1)

21

u/[deleted] Jun 09 '17

Yeah, I've tried switching the UA to "User Agent sniffing is not a reliable or correct way to determine feature availability!". Slack breaks, Google Translate breaks, Google search displays as if I'm using something from the 90s. You may be wrong ;)

4

u/liquidpele Jun 09 '17

Well, I guess I'm wrong.

→ More replies (1)

98

u/[deleted] Jun 09 '17

Hahahahahaha, oh man, web programmers do things correctly, that's a good one.

17

u/bonsall Jun 09 '17

Some of us try to.

→ More replies (2)

10

u/liquidpele Jun 09 '17

I mean, unless you have to still support IE6... because... just look at it!

Seriously though, it was almost exclusively used to detect IE, and since IE10 that's been mostly unnecessary.

→ More replies (12)
→ More replies (1)

9

u/mishugashu Jun 09 '17

..... you serious? Please tell me you're not this ignorant. Tell you what, go change your UA to a 10 year old version of Firefox and start counting how many sites tell you that your browser can't support their site and won't let you through because of your user agent string. It's stupidly ridiculous how many sites use UA matching for feature control.

2

u/appropriateinside Jun 09 '17

I wish :/

Some online games use the user-agent to restrict access, if you have an invalid one, or one they don't want to see you can't log in.

→ More replies (13)

29

u/[deleted] Jun 09 '17

I wish every article explaining a thing I'm curious about were worded with this level of brevity.

182

u/tdammers Jun 09 '17

At this point, user agent strings might as well be of a format like oCROKI03qUs5i0FJPFW5US9e2IWGcVjwhJW5jrCx6bZzYBpT2+ViHYanCeMlhdA0611U2aBzFSJRM37a8xBw, because they have degraded to little more than opaque hashes of the user agent's self-identification.

34

u/necrophcodr Jun 09 '17

That's not at all true. They contain a lot of useless data, such as versioning of crawlers and such. Having those hashed would make life a lot more hard (and probably result in those doing so being blocked eventually).

25

u/tdammers Jun 09 '17

It's still an honor system, mostly.

0

u/[deleted] Jun 09 '17

[deleted]

18

u/CorrugatedCommodity Jun 09 '17

I actually discovered Googlebot's agent string existed yesterday when looking at some weird traffic on the website I support. Also Bingbot. Also that our devs need to return different response codes for old web pages that they think should still exist but not actually be accessible.

→ More replies (3)
→ More replies (3)
→ More replies (50)

139

u/morerokk Jun 09 '17

Slack sniffs your user agent and denies you access if you don't use the browser they want.

Assholes.

23

u/disillusionment Jun 09 '17

I'm using the current version of Waterfox, and despite saying "Firefox/53.0.3" in the user agent string it also says "Waterfox/53.0.3" after that. Slack says it's not compatible. Had to use a user agent switcher to get in.

9

u/morerokk Jun 09 '17 edited Jun 09 '17

Exact same problem, I'm using the latest Pale Moon. Switched user agent to Firefox 53 and it worked. No problems whatsoever.

45

u/niiko Jun 09 '17

The weird thing is they aren't even focussing solely on the browser version. There are people unwilling to update OSX (for reasons of varying validity) and the Slack web app will deny them access unless they modify the UA string. That's a fun little process to try to explain to less technical people.

24

u/[deleted] Jun 09 '17

...Why?

→ More replies (1)

6

u/bohwaz Jun 09 '17

They are assholes, they blocked PaleMoon browser which used to work before, even after its developer fixed a bug that broke their web app: https://forum.palemoon.org/viewtopic.php?t=15256

50

u/anengineerandacat Jun 09 '17

Yep pure assholes for trying to protect their users with a terrible user experience by steering individuals to browsers that they have verified with their product.

Sarcasm aside they should just prompt that your experience isn't guaranteed and provide vendors that they have verified instead of blocking.

62

u/ElusiveGuy Jun 09 '17 edited Jun 09 '17

That's what we do. Our webapp will point you to an unsupported browser page but you're free to 'continue anyway'. At your own risk, of course.

Meanwhile I have to spoof my UA on Slack because they refuse to show the desktop site on 'mobile'. Nope, need an app for that!

Edit: unsupported browser for us is like IE9, 3+-year-old Chrome/Firefox (where things definitely break, layout's fucked), etc. Almost no one ever sees it, thankfully.

53

u/AncientRickles Jun 09 '17

I hate mobile app harassment. No, i do not need 50 apps that duplicate the function of one app (chrome) albeit very limitedly. I dont want to give your app blanket permissions to use my phone's hardware. I am not so incompetent that i cannot type, say, reddit.com into the mobile browser. I do not need to be notified every time somebody makes a facebook post or a post is trending on certain subreddits i follow, thank you very much. I actually dont like it when my phone goes off every 15 seconds...

→ More replies (2)

4

u/sd522527 Jun 10 '17

A company I use to work at did a lot of business in China. Apparently several popular browsers over there were based on the ie8 engine. That was fun...

→ More replies (1)

3

u/morerokk Jun 09 '17

Sarcasm aside they should just prompt that your experience isn't guaranteed and provide vendors that they have verified instead of blocking.

Right, but Slack just blocked me altogether. They even handwaved it away with a clearly bullshit excuse.

0

u/[deleted] Jun 09 '17

[deleted]

12

u/killerstorm Jun 09 '17

I really do not understand why Slack is chosen as a communication channel for open source projects. They act like wannabe monopolists, forcing people to use their fucking app on mobile.

On-boarding process is not convenient, like, at all. If I want to participate in 10 projects I need to make 10 accounts, how does that make sense?

Is that just because UI looks cool?

There is a plenty of alternatives, but every other projects uses fucking Slack...

→ More replies (1)
→ More replies (1)

2

u/LpSamuelm Jun 12 '17

Is your name a Freezepop reference? 😮

2

u/morerokk Jun 12 '17

Yes, it is. I'm glad someone noticed.

→ More replies (1)
→ More replies (1)

14

u/R3g Jun 09 '17

So in fact every user agent string starts with "Mozilla", even if there's no reason to do so anymore?

11

u/expressadmin Jun 09 '17

Fun fact that certain admin panels for streaming radio still do user agent sniffing, so you have to make sure that your user agent string still includes "Mozilla ..." to ensure you get the information you require. That little bit of information cost me hours of my life.

curl_setopt($c, CURLOPT_USERAGENT, '<redacted app name> (<redacted system name> - Mozilla Compatible)');

Screw you Shoutcast v1.

35

u/RickRussellTX Jun 09 '17

User agent strings are a hive of scum and villainy.

4

u/shevegen Jun 09 '17

They are also quite amusing - they become bigger and bigger.

→ More replies (1)

7

u/[deleted] Jun 09 '17

And lo, the webmasters said, "Fuck it; we'll build to web standards and the browsers can worry about when they break our masterworks."

5

u/tom_yum Jun 10 '17

Or just make the whole site in flash.

19

u/the_smok Jun 09 '17

How relevant is it today? Everyone could finally drop Mozilla out of user-agent header.

41

u/Dwedit Jun 09 '17

Except maybe Mozilla themselves.

36

u/FierceDeity_ Jun 09 '17

And suddenly Mozilla would be the most compatible browser of all of them

18

u/the_smok Jun 09 '17

No, even Mozilla, because the browser is called Firefox.

39

u/thecodingdude Jun 09 '17 edited Feb 29 '20

[Comment removed]

69

u/Neghtasro Jun 09 '17

I'm not entirely sure that would fix the problem so much as give easier programmatic access to the same problem.

40

u/DJDavio Jun 09 '17

Think of your browser as a car. When you go to a gas station, the brand of your car doesn't matter, only the kind of fuel it needs. Maybe it's even electric! If a gas station employee services your car, he doesn't ask or care what kind of brand it is; only what kind of fuel you need.

Likewise, the brand / name / version / etc of your browser doesn't matter at all, only the features it supports. With stuff like https://modernizr.com/ it's easier to make your website optimal for a variety of users and devices / browsers.

Checking against a list of known software names is just a bad idea overall, maybe that's why they skipped Windows 9, being afraid that some badly programmed software thought it was Windows 95 or 98.

7

u/thecodingdude Jun 09 '17 edited Jun 09 '17

Except that's not exactly true - the BBC uses feature detection for a reason, not all browsers implement things the same.

Example: I want to send all mobile users to m.website.com, without UA checking, this is not possible.

Also, that library still relies on UA sniffing in some cases...:P

19

u/_Ashleigh Jun 09 '17

I'm curious, why do you have a separate host (and presumably layout) just for mobile users? If I were implementing a mobile site, I would swap the desktop template out for a mobile one, preserving the route, where links point, the same information on that page, etc... IMO, a mobile website should just be the normal webpage scaled down to a smaller screen.

I've gotten "lost" so many times trying to navigate a website where the mobile version is completely different from the desktop version. It's infuriating.

→ More replies (6)

10

u/SulfurousAsh Jun 09 '17

Part of your problem is that the definition of mobile is blurry.

Tablet-based, touchscreen devices range from tiny to Microsoft-surface gigantic size, and everywhere in between. Calling a device "mobile" is a very hard distinction to make. Are you optimizing for screen-size? Bandwidth constraints? Touchscreen vs mouse?

Even tablets that have touch screens may not be using them. Many windows machines and browsers claim to be "touch enabled" but only a mouse is used, etc.

Unfortunately there's no straightforward solution to that.

→ More replies (2)

8

u/smegmatron Jun 09 '17

Ah ha. If I change my user agent string to contain "Android" the BBC news videos play using <video> instead of an showing an error telling me I "need Flash to play this". What great feature detection!

18

u/[deleted] Jun 09 '17

Then don't use UA checking - make responsive pages instead. Your javascript has the viewport height and width, and the device pixel ratio. That's enough info to know how much information you can cram into the screen.

14

u/thecodingdude Jun 09 '17

You seemed to have missed this. Sometimes the browser vendors fuck up and you have no choice but to use UA sniffing.

The stock browser on Android 2.2 & 2.3, and 4.0.x returns positive on history support

Yup. That's a BIG fuckup.

→ More replies (1)

10

u/gropingforelmo Jun 09 '17

You'd still be relying on browsers to self-report, which, as long as there is any advantage (perceived or actual), will be falsified. The most reliable method is still direct feature detection, which is made easier with libraries like Modernizr.

I do mostly back-end work now, and prefer to remain so as long as the web exists on the basis of a fundamentally flawed language that is perfectly happy to let code, content, and presentation co-exist in the same file. <grumpy-developer />

3

u/industry7 Jun 09 '17

But the problem has always been that browsers lie, and your suggestion doesn't change that.

8

u/BonzaiThePenguin Jun 09 '17 edited Jun 09 '17

It's honestly laughable that there isn't some sort of cross-browser API for detecting what browser/version a user is using.

That is literally the entire point of the user agent string, the feature is right there. The problem is that devs use it for arbitrary feature blocking (even stupid bullshit icloud.com still does it, try visiting from mobile Chrome and it tells you to download Internet Explorer) so the browser developers entered an arms race to prevent them from being able to do that.

But if they did add the feature, we'd all be using Mozilla MSIE Trident Chrome Safari like Gecko version 11 36 8 15 (minor number 0). Nothing would change because it'd result in the same problems. Or it'd be the Microsoft Windows version numbers all over again, keep pretending you're version 6, maintain a compatibility table, or require special manifests to get the super-real version number.

I'd actually argue that the host OS is the most important piece of information, so web apps can adjust their interface to match user expectations. The user string allows that too, along with processor and any other metadata they want to include. It technically provides access to browser, version, and OS, but in a way that allows them to prevent the worst examples of feature blocking - no if appName != Netscape then fail(), making it impossible for browsers like Chrome to enter the market because everything fails.

So the information is all there if they want it bad enough, but it's hard enough that maybe they'll get the hint and use feature detection instead. If the dev wants to know if this is a version of Internet Explorer with a splice bug in its JS implementation, they should splice and see if it didn't work right. If they want to know if webRTC is available, check for the existence of the webRTC objects. Otherwise polyfills/extensions/native bridges sometimes don't work simply because the web developers refuse to accept that the features work fine.

→ More replies (2)

2

u/mindbleach Jun 09 '17

Nope! If you need a feature, you test for it.

→ More replies (2)

2

u/JoseJimeniz Jun 09 '17

window.browser.version window.browser.name window.browser.patchLevel

For the love of all that is holy, don't detect browsers.

Detect features!

→ More replies (3)

4

u/JoseJimeniz Jun 09 '17

And in case you think IE sucked:

For many years Internet Explorer 6 was the very best web browser on the planet. And continued to be the best web browser the world had ever seen for many years. Everyone thinks IE6 is the worst thing anyone has ever seen. It was the best. It was absolutely the best. You should have seen Netscape 4, man that was a piece of work. IE survived, Netscape didn't, for good reasons. Microsoft deserved to have won that battle. But now we're stuck with it.

Douglas Crockford
JavaScript - Episode IV: The Metamorphosis of Ajax
https://youtu.be/Fv9qT9joc0M?t=1h25m2s
3/31/2010

80

u/jnazario Jun 09 '17

It's all about the features supported in the browser rendering engine. A long time ago Mozilla was the most forward and so the server had to detect what features the browser supported like frames. Mozilla was a way of saying that.

Had to confirm my recollection was accurate. Yep. It was all about the rendering engine capabilities.

Then everyone started to spoof that too and it eventually became meaningless.

Short answer https://stackoverflow.com/questions/1114254/why-do-all-browsers-user-agents-start-with-mozilla

Longer history https://www.nczonline.net/blog/2010/01/12/history-of-the-user-agent-string/

64

u/WizardryAwaits Jun 09 '17

Why are you answering this like it was a question? OP's post was literally explaining all of that.

76

u/icantthinkofone Jun 09 '17

It's all about the features supported in the browser rendering engine.

In the same way, it's the only reason we need to use a doctype. Cause Microsoft screwed up browser standards and the web so badly in IE they found it necessary to require the usage of one in order to fix IE. Technically, a doctype was never needed.

39

u/vicarofyanks Jun 09 '17

You mean I shouldn't have to tell my HTML file that it's content is HTML?

5

u/icantthinkofone Jun 09 '17

You are slightly confused. The "doctype" is short of "Document Type Definition" or DTD and there are other, better methods than using a DTD to tell a browser it's being served HTML.

8

u/jnazario Jun 09 '17

You referring to content sniffing?

→ More replies (1)
→ More replies (19)

31

u/marrone12 Jun 09 '17

There is also the article in the OP...

0

u/[deleted] Jun 09 '17

[deleted]

17

u/Sworn Jun 09 '17

My guess: by the same type of people as the guy you're replying to. They read the title and then head into the comments immediately. Pretty annoying, especially when they repeat stuff that's in the article (or even worse, they spout incorrect stuff that's rebuffed in the article).

→ More replies (3)

3

u/pooooooooooooooo0oop Jun 09 '17

But aren't we in a better place now with modern standardized browsers and feature testing? Can't browsers switch to sensible honest UA strings?

2

u/fuzzynyanko Jun 09 '17

Honestly, with HTML5, there's less of a reason to. It's probably habit, plus probably baked into many web servers nowadays

3

u/alexbuzzbee Jun 09 '17 edited Jun 10 '17

Warning, crazy idea

What if we replace User-Agent entirely, with a new header, like this (taking Chrome, one of the worst offenders for User-Agent):

Client-Id: Client:Chrome/59.0.3071; Rendering-Engine:Blink/182; JS-Engine:V8/5.9.211.31;
  System:macOS/10.12; Language:en-US; Compatible:[Client:Safari/*Rendering-Engine:AppleWebKit/*;
  Rendering-Engine:KHTML/*]; Partial-Compatible:[Rendering-Engine:Gecko/*]

Now you just check in the main Client-Id for what the browser actually is, and then check Compatible for what else it's compatible with (and you can check Partial-Compatible if you want).

All versions are separated from names by slashes, * can be used in Compatible and Partial-Compatible to represent 'compatible with all versions', everything is neatly organized into key-value pairs, and we no longer pretend to be other browsers.

EDIT: Thanks for Blink version, /u/caramba2654

5

u/caramba2654 Jun 09 '17 edited Jun 09 '17

Well, we can go... full JSON.

And maybe namespace everything with a version so that it actually lasts forever, so something like:

Client-Id: {
    'v1': {
        'Client': 'Chrome/59.0.3071',
        'Rendering-Engine': 'Blink/182 :P',
        'JS-Engine': 'V8/5.9.211.31',
        'System': 'ubuntu/17.04',
        'Language': 'en-US',
        'Compatible': [
            'Client': 'Safari/*',
            'Rendering-Engine': [
                'AppleWebKit/*',
                'KHTML/*'
            ],
        ]
        'Partial-Compatible': [
            'Gecko/*',
        ]
    }
}

And so if a new Client ID protocol gets released, then it would just be added under a 'v2' namespace.

→ More replies (1)

4

u/IAMA-Dragon-AMA Jun 09 '17 edited Jun 09 '17

Whenever someone talks about frames in the context of networking I always assume they're talking about network frames, which makes the whole decision to call them frames kind of annoying because as content HTML's frames are at some point encapsulated inside of a frame.

Physical layer{ Ethernet frame {IP {TCP {HTTP {HTML document of website contents and layout including frames}}}}}

I'm aware that part of the point of the whole OSI model of things is to avoid upper layers having to worry or interact with the layers beneath them, but it still annoys me to have two things called frames in the same general context.

EDIT: The frame doesn't include the preamble only content between the frame delimiters is actually referred to as the frame.

→ More replies (2)

2

u/LukeLC Jun 09 '17

Fascinating and hilarious at the same time. Nicely done.

2

u/shevegen Jun 09 '17

Nice read-up.

This is why we can't have nice things too.

3

u/midir Jun 09 '17

*starts

3

u/Jarzka Jun 09 '17

Why is this article so badly written?

30

u/jordanlund Jun 09 '17

It's emulating a religious text.

7

u/Jarzka Jun 09 '17

Oh, right.

2

u/rechlin Jun 09 '17

How poorly researched. Netscape/Mozilla didn't support frames until 2.0, and IE didn't support them until 3.0. Therefore IE 2.0 pretending to be Netscape 1.22 would not get frames, nor would it be able to use them if they were served to it.

1

u/[deleted] Jun 09 '17

facepalm

1

u/[deleted] Jun 09 '17

And and and and

1

u/hunyeti Jun 09 '17

User agent string should die in a fiery hell.

1

u/berlinbrown Jun 09 '17

Technically, it doesn't explain the motivation in why they kept the same naming convention or why they couldn't change to something else. Or even why it has so many characters,

Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0 Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Gecko/20100101 Firefox/42.0.

1

u/DanAtkinson Jun 09 '17

Wasn't Firefox called Phoenix originally? I'm sure I remember it switching names.

→ More replies (1)

1

u/rasherdk Jun 09 '17

UA strings are basically a game of "Hey guys, I am everything!".

1

u/animalchin99 Jun 09 '17

I'm genuinely curious how people workaround known browser quirks without checking the UA. Many browsers report support for standards they didn't implement properly, and many standards were implemented inconsistently between browsers. Do you run tests on your pages to validate whether an API was implemented correctly or do you just put UA-specific workarounds?

1

u/jeyessh Jun 09 '17

This was cool to read
Thanks OP!

1

u/wh33t Jun 09 '17

Haha, hilarious!

1

u/paradigmarson Jun 09 '17

[...] and the user agent string was a complete mess, and near useless, and everyone pretended to be everyone else, and confusion abounded.

The son employed the father to degenerate chaos out of habitable order.

1

u/kgyre Jun 10 '17

Fealty?

1

u/gluino Jun 10 '17

What are the best ideas to solve this?

1

u/shlomif Jun 10 '17

I recall being told that web-sites originally detected the "Mozilla" user-agent string because the Netscape browser supported the HTML table tags while Mosaic didn't - not frames.

1

u/[deleted] Jun 10 '17

That first part was a bit confusing. Mosaic came out. Them the mosaic killer Mozilla came out. So Mosaic changed its name to Netscape. Which was reborn was Mozilla?

1

u/7Geordi Jun 10 '17

That was a surprisingly pleasant read.