Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Frankly, Firefox should take the nuclear option, and just start emulating Chrome with regard to website identifiable information.

In particular, User-Agent strings are now a net-negative. I've never run into a website that doesn't work on Firefox. I do occasionally run into websites that claim to not work on Firefox. We software developers have shown that we can't be trusted with information pertaining to what browser someone is using, and as such should have the privilege taken away. If you're reading this, and you have access to a codebase that reads User-Agent strings for anything more than idle curiosity, just delete it and push to master.



I actually ran into a case for using UA strings yesterday, if you know of a better solution let me know!

I have a canvas element where the user needs to be able to both scroll and zoom with the mouse wheel. Generally, zooming involves scrolling while also holding the ctrl button down - except on MacOS, where it's cmd. I obviously want to use the operating system conventions that my users will be expecting, but the best way of determining that, that I've found, is searching for the string 'Mac' in the user agent string.

Like I say, if you know of a better way to detect whether I should be binding on ctrl or cmd, let me know! This is the first time I've used the user agent in a long time, and it feels like there should be a better system...


You mention 2 behaviors: With and without a modifier key. So just accept either key for zooming. :)


Especially considering it is vanishingly unlikely for a Windows user to inadvertently send you a command key down, or the Mac to send you a ctrl down. It's not like you have behaviors to swap.


That's actually a really good idea. I just looked at how a few other sites handle this, and that seems like a common take. I have updated the code!


UA string sniffing sucks, but if Firefox starts pretending to be Chrome, sites will start using even worse methods to figure out what browser they're dealing with, and it'll be much harder to work around those. Firefox is obviously not Chrome if you actually poke at it a bit… the saving grace of UA string checks is they're easy to fool.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: