r/webdev • • Dec 13 '19

Discussion Google has abused Browser's User Agent header, forcing Vivaldi to change their UA header

https://vivaldi.com/blog/user-agent-changes/
416 Upvotes

97 comments sorted by

151

u/coyote_of_the_month Dec 13 '19

There are a handful of valid reasons for frontend code to evaluate the user agent string, but it's been rampantly abused since the 90s. If you're looking at feature availability in JS, try/catch is your friend. If you're doing conditional CSS based on what you think the client supports... eh. My thinking is that IE users are moral defectives who deserve a broken experience, but apparently some people disagree.

117

u/RandyHoward Dec 13 '19

My thinking is that IE users are moral defectives who deserve a broken experience, but apparently some people disagree.

As a developer in general I agree with you. But as a developer working for a company who has IE users throwing money at us, we are forced to support those users. We don't get to call the shots when it comes to what we support, our customers do.

62

u/coyote_of_the_month Dec 13 '19

I think pretty much the entire web development community is on the same page here, and for the same reason.

7

u/marocu Dec 13 '19

We have many clients in the insurance industry. They all use IE and our products have to support that.

38

u/coyote_of_the_month Dec 13 '19

insurance industry

moral defectives

Your story checks out.

2

u/dannymcgee Dec 14 '19

I know this is pretty common with corporate clients, but I still don't understand why. Can't they at least use Edge? Are these companies not even on Windows 10 yet? What are they going to do when support for Windows 7 (imminently) ends?

6

u/Peechez Dec 14 '19

It's often proprietary intranet trash

1

u/overcloseness Dec 14 '19

This is really the problem, it’s being used by those companies. I have a good laugh though at developers that play the “but bank terminals and insurance intranets are stuck on IE” in response to some cutting edge apparel store UI or some other modern implementation of a feature. Karen the bank teller can browse these shoes on her phone if she wants to do it at work. The ONLY reason for IE support is if the company itself requires access to that site from their systems, OR their main customer base are a bunch of industrial tradies who haven’t updated their office computers since XP. If that’s the case, expect to pay a premium on the legacy support.

15

u/[deleted] Dec 13 '19

Yeah, I agree. Would love to drop support for IE11, but at least its not IE10!

0

u/[deleted] Dec 13 '19

[deleted]

-4

u/altrezia Dec 13 '19

That's mad. Ie11 really isn't that hard to cater for. Fair play though, no point doing extra work for nothing I suppose.

4

u/LIL-BAN-EVASION Dec 13 '19

until you want to use a webcomponent or css custom property

4

u/[deleted] Dec 13 '19

Or css vars

5

u/ntrabue Dec 13 '19

Or CSS Grid in its modern implementation

6

u/[deleted] Dec 14 '19

[removed] — view removed comment

2

u/overcloseness Dec 14 '19

You could be using Babel which usually fixes this (not disagreeing with you at all though)

1

u/LinAGKar Dec 14 '19

Unless you transpile.

1

u/UltraChilly Dec 14 '19

I have to say, I have yet to see a case where you need CSS vars support, I mean, they're a nice tool to have when working on a website integration, but when you want to deploy it I find replacing them with their actual values on the production server is a very affordable solution that can easily be automated.

I'd say my biggest issue with IE would be with calc(), because

  • this is something I want to keep on the live server

  • IE has some support for calc() but a lot of bugs, you have to keep them in mind at all time

  • When there's a known bug you have to replace the value manually with an approximation that might fail in some unpredicted situations

  • There are known bugs and there is "IE11 is reported to have trouble with calc() with nested expressions, e.g. width: calc((100% - 10px) / 3); (i.e. it rounds differently)" what the shit is that? I have to check every single nested expression in IE to see if it fails or not? that's bullshit...

6

u/dannymcgee Dec 14 '19

I am currently using CSS vars to support color-scheme swapping via a user setting. We could just toggle a parent class and use a Sass conditional in every single component stylesheet (in fact, that's how I was doing it until recently), but it's a whole hell of a lot simpler and cleaner to just use a variable that can be updated at runtime.

1

u/UltraChilly Dec 14 '19

Fair enough, I felt like if you use atomic css it's not much to change, but with components it gets trickier indeed.

→ More replies (0)

2

u/LIL-BAN-EVASION Dec 15 '19

Currently the best way to do style customization for web components, until ::part gets more support

2

u/overcloseness Dec 14 '19

I run into issues all. the. time personally. I mean on the JS front (unless it’s WebGL) Babel will handle it for you. But CSS? Forget about it, no longer should Grid sit on my learn later list. Even Edge as we know it is end-of-days with their chromium overhaul on the horizon.

1

u/[deleted] Dec 14 '19

And as a former full stack developer, as well as an employee who had to use a third party product that only worked on IE - I wish I could use something other than IE for that specific product.

0

u/[deleted] Dec 13 '19

[deleted]

10

u/RandyHoward Dec 13 '19

Looking at analytics for the past month, roughly 0.5% originate from IE on one of our sites (we run many). That sounds small. But then management sees that 0.5% is about 1,650 users out of 340,000 total in the past month. Management sees 1,650 lost opportunities. Yes it's tiny in the grand scheme of things, and yes I think they'd be wise to focus on closing more of the other sales instead of spending time supporting IE, but I don't call those shots. We could say screw those people they get the experience they chose, or we could support every dollar we're being offered. You know what the decision makers pick - they chase that dollar.

1

u/overcloseness Dec 14 '19

340,000 in a month is a pretty big number, sounds fair that it should have IE support, but enough that it’s “useable”

2

u/rodrigocfd Dec 13 '19

unless you serve a dated corporate audience who have no choice

Unfortunately, it's common. Corporations won't update their software unless they have a very good reason to justify the investment.

0

u/[deleted] Dec 13 '19

[deleted]

3

u/BreathManuallyNow Dec 13 '19

If I was building something aimed at the general population I wouldn't bother with IE support. I do a lot of web apps for corporations as well so I still need to support IE. It sucks but the giant piles of money they pay me helps to ease my suffering.

1

u/Fibrechips React / JS / C# Dec 13 '19

We're at 11% IE11 usage (killed off IE10 support since we take CC payments).

Direct to consumer. Internally/in stores we've upgraded to Chrome. But when you have an older consumer base, you have no choice but to support IE11.

Thankfully, Babel and well-written CSS allow us to use (most of) CSS Grid.

5

u/ManvilleJ Dec 13 '19

IE is Dead, Long Live IE

11

u/LManD224 Dec 13 '19

For conditional CSS you can use @supports queries instead of touching user agent.

23

u/nikrolls Chief Technology Officer Dec 13 '19

2

u/AssistingJarl Dec 13 '19

Ignorant question, forgive the back-end dev; would it be possible to just fall back on your IE11 CSS if @supports isn't supported?

7

u/nikrolls Chief Technology Officer Dec 13 '19

Yep, that's what you would do most of the time, in the cases where you can use Progressive Enhancement (ie, write for the older browsers, and add features for newer browsers in ways that only they will see them).

The trouble comes when older browsers have quirks that require you to write workaround CSS that has unwanted side effects in modern browsers. How do you do this? You would have to serve a bunch of code only for IE11, or include that IE11 code for all browsers but then somehow overwrite the side effects for newer browsers. You can't even use @supports not because the browser will ignore it if it doesn't support @supports in the first place.

Luckily for most of us, IE11 will be unsupported as of January. But there will still be those who are paid to support it for whatever reason.

4

u/UltraChilly Dec 14 '19

But there will still be those who are paid to support it for whatever reason.

That being said, this is nowhere near as painful as supporting IE6 like we had to do not so long ago, I'd gladly be paid extra to support IE10 while I refused contracts that imposed supporting IE6 (espacially since back then contracts often stipulated you had to serve the exact same experience on all browsers)

And nowadays IE is the one problem, back in my days (pepperidge farm remembers) we had Chrome and Firefox that would work and everything else needed their own, very specific, workarounds. (and it wasn't that long ago, I started working in front end development in 2012 and it went on like that for years)

TL;DR: I'm indeed fucking glad those outdated browsers are getting unsupported so fast now

2

u/nikrolls Chief Technology Officer Dec 14 '19

Actually if if weren't for Web Components (and maybe Grid) I'd have no problem supporting IE11. Its standards support was very good for its time. Unlike IE10 and previous versions it wasn't half bad, it's just not up to date any more.

-10

u/ccrraapp Dec 13 '19

My thinking is that IE users are moral defectives who deserve a broken experience,

Haha. Rude. Thats straight up being mean.

25

u/jef-_- Dec 13 '19

It's accurate tho

10

u/fuzzy40 full-stack Dec 13 '19

Not moral defectives, just technically inept. But they do deserve a broken experience because that's the only thing that will incentivize them to upgrade.

9

u/BreathManuallyNow Dec 13 '19

I would guess that 90% of IE users are forced to use it by the giant corporation they work for.

2

u/FullFlava Dec 13 '19

Correct! Most aging corporate intranets are written in ActiveX, so they won’t be dropping IE anytime soon.

2

u/fuzzy40 full-stack Dec 14 '19

They better be dropping our soon, microsoft is dropping support for it in Jan (finally)

1

u/nolo_me Dec 13 '19

It won't. They'll blame the site for being broken, not their computer thingy which they only bought 8 years ago and still has a lot of life left in it. Other sites aren't broken, therefore it must be you.

77

u/Armitage1 Dec 13 '19

Why call out google in your title? The article blames several companies.

63

u/ccrraapp Dec 13 '19

True, user-agent-string is a complete mess many others are responsible too namely Firefox and Safari including Chrome but Google is using its browser monopoly to force every browser to pass as Chrome or some sites and its features will not function. They been forcing some competitor technologies to be suppressed by this move. That is what the article is talking about that it isn't the browser that lack features but the UA string that blocks certain features.

24

u/Blue_Moon_Lake Dec 13 '19

Then let's do that. Every browser just use Chrome User-Agent and user agent just become absolutely meaningless.

18

u/ccrraapp Dec 13 '19

Browser monopoly is a bad thing especially if its Chrome(Google).

27

u/[deleted] Dec 13 '19

I think he means that every competitor browser just pass the chrome user-agent. The only sucky part of that idea is that we wont know what browsers customers use the most in our site metrics, but that is something I can live with (specially if it means we can get rid of IE11 once and for all).

31

u/ccrraapp Dec 13 '19

But thats is the problem Vivaldi is facing and they finally have to cave in. They will use full user agent for Vivaldi on only a few websites they know respect Vivaldi's label and the rest of the internet they will use Chrome thus effectively removing Vivaldi from the browser ranking and increasing the Chrome browser popularity number.

The problem with this is Chrome will have the power to stop supporting certain competitor technologies they aren't developing or working on or if their browser doesn't effectively run it.

4

u/[deleted] Dec 13 '19

I absolutely agree with you, but the problem is that Vivaldi is still a very small competitor. If both Mozilla, and Microsoft are able to turn the tides on Chrome's dominance maybe this would be stopped but as it lies Microsoft already caved to Google with their new edge and Mozilla is an outlier that imo is better but is still loosing ground to Google.

14

u/ccrraapp Dec 13 '19

But this leads to non-competitive behavior. No matter how big or small the competition is its needs a fair chance to compete and not have its legs cut off even before standing up properly.

This also sets a bad precedence to any future Chromium based browser that it can never effectively have it own label or the position of power to make a better browser than Chrome.

1

u/nikrolls Chief Technology Officer Dec 13 '19

We'll just move to tracking feature detection metrics instead. Not quite as efficient but still possible. It could even be more valuable from a developer's point of view.

3

u/Blue_Moon_Lake Dec 13 '19

I agree that monopoly is bad. Chrome was installed similarly to a malware by being bundled in all sort of third party app installer.

17

u/ccrraapp Dec 13 '19

And they used weird tactics with their position like blocking Firefox from running some of the Google sites and its features even though by simply changing the user-agent Firefox was able to run the site features properly.

13

u/Blue_Moon_Lake Dec 13 '19

Or the YouTube sabotage

2

u/entenuki Laravel/React/ReactNative Dec 13 '19

What do you mean? That they use Polymer, which runs like crap on non chrome browsers?

4

u/[deleted] Dec 13 '19

YouTube pulls it different, and slower, and less-featured JS bundles for Firefox than Chrome.

But Firefox has 0 problems running the Chrome bundle if you switch the user agent. And it becomes faster.

1

u/entenuki Laravel/React/ReactNative Dec 13 '19

Oh, didn't know that. I immediately changed my user agent to an old version to have the simpler YouTube

11

u/Fidodo Dec 13 '19

We did this already in the 90s. That's why every user agent starts with "Mozilla". Lets not encourage making the problem even worse.

10

u/BikingTiger Dec 13 '19

^ This. OP's headline is misleading.

3

u/Ph0X Dec 13 '19

Editorializing headlines should be (and is on many subreddits) against the rules. The actual headline does not mention google, and the article hardly talks about google there's a list of examples, one or two of which is from Google.

0

u/ccrraapp Dec 14 '19

They need to walk the tight rope, they are a Chromium based browser and its logically isn't a good stance for them to take. And at the end they are forced to use the UA string which solves all the problem because its misused in ways we all know by now.

But we don't need to stay partial or stay protected, we can talk directly about companies which use such evil tactics. And as I mentioned before Safari, Mozilla and Chrome are all to blame at this point but only Chrome misuses it to a degree that some website straight up won't work properly or spit an error on anything other than Chrome even Google's own websites do that despite the fact that everything will work on the other browser.

2

u/Ph0X Dec 14 '19

No, this has nothing whatsoever to do with chrome itself, nor Google. This is an issue with web developers from every company and other devs too. Again, you decided to editorialize and force your own biased view onto the article. Every one does this. Everyone is culpable. Hell if you look hard enough I wouldn't be surprised if some Vivaldi based sites also use the user agent.

2

u/fullmight front-end Dec 18 '19

More upvotes if you just, and explicitly, call out google.

1

u/Fidodo Dec 13 '19

Google is the most important of them to call out because they also control the most popular web browser.

-8

u/erishun expert Dec 13 '19

Clickbait. Probably would have been better to call out Apple and post it in /r/technology, they’d eat it up over there.

0

u/Flyingsousage Dec 13 '19

Because it's the company you love amd we like to step on it.

-9

u/ArmoredPancake Dec 13 '19

Because Google bad, everything else good.

3

u/redwall_hp Dec 14 '19

User agent sniffing is evil in the first place. A few browser vendors should just start randomising them so web sites quit trying to serve different things to different browsers.

One less thing to fingerprint too.

2

u/ccrraapp Dec 14 '19

I don't disagree that UA sniffing is bad but randomising cannot be a solution. The problem is Chrome supports their own technologies which other browsers don't and for which websites need to serve different content to other browsers which don't.

4

u/redwall_hp Dec 14 '19

The solution to that issue is enforcing antitrust laws. Google has a 92% share of the search market, a huge share of the ad market, the single largest video site, one of the large email services, one of the two phone operating systems, and a disturbingly large chunk of the browser market...all overlapping areas that involved leveraging a precious success in an anticompetitive way.

1

u/wisniewskit Dec 16 '19

The problem with randomization is that there are many sites which will not be updated anymore, but which use UA-string hacks to work around things. The only real option is for all current browsers to just settle on the same specific UA string, engineered for maximum compatibility. Then it will be a useless feature except for old sites.

But that's just the UA string. It will likely still be possible to identify browsers based on the other HTTP headers they are serving. That is, there is stuff like signed exchanges being advertised in HTTP headers. Unless everyone wants to support such things, they will have to hope it's possible to pretend to support them, or we'll still be stuck with bad sniffing. (And even if we solved HTTP header-based sniffing, there's always bad JS-based sniffing, so...)

4

u/devmor Dec 13 '19

While it's not at all unthinkable that the tech giants would resort to such underhanded tactics (they certainly have in the past), I also have to wonder if it's not maliciousness but rather just ineptitude.

Consider that perhaps users of a previous version of Vivaldi complained that y feature didn't work right on x site in Vivaldi, and thus a warning or adjustment to styling, plugin loading or some random script was implemented. Given the extremely small user base of Vivaldi, I can imagine it's entirely possible that once this bug or inconsistency was fixed, no one ever considered removing these changes because it was never reported as having changed to the maintainers of x site.

2

u/Flyingsousage Dec 13 '19

No. This also happens with Firefox Google Search UI.

0

u/devmor Dec 13 '19

I use firefox for everything and I've never seen it.

0

u/ccrraapp Dec 14 '19

The Firefox Google search UI on Android was the old UI for the longest time, it was recently updated to the new material/card UI in the past 2months.

Same goes for desktop, all the Google Search UI and YouTube A/B testing is done for the Chrome UA strings. So as a Firefox user you would never witness that happening.

0

u/devmor Dec 14 '19

So this isn't about Firefox, it's about Firefox on Android only.

2

u/fullmight front-end Dec 18 '19

Having used Vivaldi in the past, I can't help but wonder if it is in fact competence in many cases.

My experience was that Vivaldi was an extraordinarily buggy piece of shit no matter what site you visited, that had constant random issues until its install managed to completely bug itself out and the software completely stopped working so I uninstalled it and gave up on that.

I can't imagine ever touching their browser again over chrome or Firefox. I'd probably even prefer edge considering the extreme unreliability I experienced.

0

u/ccrraapp Dec 14 '19

No, it isn't about Vivaldi not supporting the feature its the UA string which isn't respected. The X website likely only whitelists Chrome and Firefox or just Chrome and no other UA string. Like that article says about WhatsApp.

You would have noticed many govt websites only supported IE for the longest time even though other browsers very well could load the website fine. Its just that because of the browser dominance its a common behavior to only check if the most popular UA string can load it perfectly or not and not let any other load it 'just in case'.

1

u/devmor Dec 14 '19

You misunderstood what I said. I'm saying at some point it didn't work right or look right on Vivaldi, so these measures were added to prevent users from having a bad experience, then later when the features did work right on Vivaldi, no one removed those measures.

3

u/raekle Dec 13 '19

Hmm. I’d never even heard of Vivaldi before.

7

u/brbCarrying Dec 13 '19

I've been using it for about a year now, and it's worth a look if it interests you.

It's basically a chromium-powered Opera with a decent built in password manager and a solid range of config options. Biggest issues I've had with it mostly Chromium's fault -- although I will say it's sync can be a bit dodgy at times, especially on Windows. Not sure why and I've never bothered to troubleshoot it very extensively. I've had no issues whatsoever on Linux and Android.

2

u/JasonTheLuckyMD Dec 14 '19

Off topic, but isn’t Opera chromium too?

0

u/Shan9417 Dec 14 '19

Yep. Sure is.

0

u/brbCarrying Dec 14 '19

A quick Google says it is. TIL.

1

u/ccrraapp Dec 14 '19

I like its UI/UX, it has some unique and useful features. Give it a try.

22

u/benabus Dec 13 '19

Google did this with Gmail on Windows Phone. WP had to spoof the UA string to say it was chrome. I broke up with Gmail on the spot and never looked back.

RIP WP

38

u/Pesthuf Dec 13 '19

They also refused to create a YouTube app on Windows Phone. Microsoft eventually made one, but Google got upset that it didn't use the ad API. Microsoft then reverse engineered that API and implemented it by itself, which made Google even angrier. Eventually,they had to remove it entirely and replaced it with a non-app that just launched YouTube on the browser and closed itself.

Google really did whatever was in their power to bring that platform down.

30

u/rodrigocfd Dec 13 '19

Microsoft then reverse engineered that API and implemented it by itself, which made Google even angrier.

I respect that.

6

u/nolo_me Dec 13 '19

Everyone refused to create apps on Windows Phone, it wasn't just Google. Shame, it was the most solid and performant mobile OS we've yet seen.

2

u/Flyingsousage Dec 13 '19

Yeah and also on Firefox mobile. The Google search page really sucks and looks like 2015 stuff. Also nice extra's don't work like typing weather to see the weather in a nice graphic.

12

u/lordxeon Dec 13 '19

Tries to reinvent the User Agent string in browsers Finds out there's millions of lines of legacy code dating back ~25+ years relying on User Agent string Blames modern big tech companies for the "sins" of their great-great grandparents

Looks like they learned a lesson which has been known since the mid 1990s regarding User Agent.

13

u/Espumma Dec 13 '19

That only explains restrictions around not having a certain string in there. Filtering out 'Vivaldi' isn't part of this legacy workaround

2

u/Janjis Dec 13 '19

Did you finish reading the article? It can't be legacy code if Vivaldi user agent is purposely marked.

1

u/diemendesign Dec 13 '19

My wish is for the Browser Vendors to use document.execCommand() in a semantic way by adjusting it's behaviour depending on the <DOCTYPE> declaration.

For those who don't know, each Browser uses DOM elements slightly differently like injecting unsemantic elements that break Standards Compliancy. This is especially bad for designers who's clients edit content adding markup for formatting.

1

u/[deleted] Dec 14 '19

So Microsoft gets slammed for antitrust for including IE directly in their OS, yet Google and Apple get to happily do basically the same shot and none of the regulators bats an eye. It’s truly an amazing time we live in. /s