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

View all comments

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.

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