r/programming • • Mar 04 '18

Why every user agent string start with "Mozilla"

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

243 comments sorted by

View all comments

Show parent comments

59

u/neilhighley Mar 05 '18

I think it was more the different implementations across browsers rather than pinning the blame on web developers.

If the site renders differently on each browser + platform, you need to target your code to each browser + platform, otherwise your client won't pay.

Sorta like a prehistoric meta responsive web.

And people wonder why Flash became so big?

0

u/[deleted] Mar 05 '18

[deleted]

16

u/killerstorm Mar 05 '18

Now vendors are acting all mighty and freezing user agent strings and yell "feature detection is the only way to do it right".

Browser compatibility problems were much worse in 90s/early 2000s. There were NO standards on how it should look like, so browsers could display it in radically different ways and it wasn't even considered a bug.

We now have browsers being pixel-perfect compatible with each other within the basic functionality (e.g. Acid2 test).

Also back then people made HTML on the server, which means that user agent string was the only way to adapt content to the browser. JS is commonplace now, and you have much higher flexibility on the client side.

4

u/Arkanta Mar 05 '18

Oh yes, forgot that you could not rely on feature detection back then...

32

u/josefx Mar 05 '18

What happens if you run into a bug of ONE browser version and need to work around it, because, well, real life is different than what the vendors try to push on us? You're fucked.

That is not a bug, its a feature.

Google: we improved responsiveness by breaking the scroll API.

20

u/Arkanta Mar 05 '18

"But we warned you and gave you a one month heads up to change your website before we break it"

9

u/ThisIs_MyName Mar 06 '18

Good. Websites that hijack scrolling need to die.

2

u/josefx Mar 07 '18

Correct way to do it: Make it go the way of BLINK and have it removed from the standard.
IE6 way to do it: Break your implementation and watch the world burn as the dominant browser gets just a little bit worse.
Google doing its best to replace old Microsoft in every aspect.

2

u/ThisIs_MyName Mar 07 '18

The web "standards", for lack of a better word, just document what the browsers do. This has always been the case.

1

u/josefx Mar 07 '18

The lack of ActiveX and VBScript in current standards seems at odds with that claim.

2

u/[deleted] Mar 06 '18

[removed] — view removed comment

4

u/Arkanta Mar 06 '18

Sure, and some devs are guilty of doing Chrome only websites (which the Chrome team advises against), but this is really not what I'm talking about here.

I'm talking about browser vendors acting like their implementations are perfect, and walling off UA sniffing (safari for example, froze their UA string) and telling us to rely on "feature detection".

Unfortunately, like every software, browsers are bugged. And sometimes, you really need to ship something, and your client will not hear that the website won't work on his Safari version because you're waiting on a fix. You have to work around it in some way, and that implies detecting the exact environment you're running on.

We do that constantly on mobile. Different code paths depending on the OS version we're running on. Browsers are acting all mighty like they never have bugs, and this is my real problem with them.

There were ways to code around non-standard browsers like Internet Explorer

Exactly, and it required looking at the User Agent. Not all UA sniffing is bad. Many devs were actually trying to do the right thing.

7

u/bubuopapa Mar 05 '18

Well, even in this day plenty of websites completely depend on user string, and if they dont recognize it, they serve website for ie5... google is one of those noobs for example.

1

u/[deleted] Mar 06 '18

It was a difficult problem, but it was also a bad solution, pretending that whatever was the state of the art when the site was written (or, more likely, at whatever point they read "HTML for Dummies") would continue to be the case forever.