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...