7 ms·
They help you figure out if a user agent wants a mobile view of a page without Javascript... which is pretty useful.
by mehrdadn 8y ago
They help you figure out if a user agent wants a mobile view of a page without Javascript... which is pretty useful.
- stavros 8y agoWe don't need user agents for that. There's an easy way to tell whether a visitor wants a cleaner view of a page, without Javascript: Yes.
- mehrdadn 8y agoI said "mobile", not "cleaner". Sizes and aspect ratios are different on phones than PCs.
- realusername 8y agothe could be accomplished just by having User-Agent: mobile, all the other data in the user-agent are useless for this purpose.
- mehrdadn 8y agoWell at least we acknowledged there's some utility. Now consider that mobile devices are different as well..
- realusername 8y agoThe current user agent does not give you much insight about what type of mobile device you have anyway, especially on Android.
- rkeene2 8y agoI use Firefox for Android on ChromeOS -- it produces interesting results.
- jrochkind1 8y agoThere is presumably some way, at least hypothetically, to fix the mess that User-Agent has become. (Everybody is 'Mozilla' now! And yet somehow a unique snowflake 'Mozilla' that lets you be tracked...) But it's not quite that. It's not that a device is "mobile" instead of "stationary" that matters. It's maybe that it's a touch screen. It's maybe that it's a small screen. (With an especially uneven aspect ratio?) Maybe that it's handheld. It's maybe the combination of all of those things. But it's not really that it's "mobile" exactly. And there are, and possibly will be increasing proportions of, devices that have some but not all of these qualities we package together in our brains as 'typical mobile'
- realusername 8y agoAll of those small differences of mobile devices are better served by media queries I personally think. You could replace "mobile" in my example by "small-screen" if you prefer.
- jrochkind1 8y agoAgreed. Media queries need to be improved though. There are no good media queries to detect "touch screen" and/or "no keyboard or mouse/pointer, only touch screen", only JS hacks that attempt it. This can matter. But yes, improving media query (or input method query?) APIs for both CSS and JS is, I agree, the correct solution to User-Agent madness. It's just not entirely straightforward or obvious or easy, and as always getting all browsers on the same page is an issue.
- devit 8y agoNot necessarily. Websites should use CSS media queries to work at all aspect ratios and sizes without needing server-side code or JavaScript.
- dragonwriter 8y ago> I said "mobile", not "cleaner". Sizes and aspect ratios are different on phones than PCs. User agent doesn't tell you size or aspect ratio. Even if you know I'm running Chrome on Android on a Galaxy Note 8, you don't know the size (physical or pixel) or aspect ratio of the viewport, because: (1) I may or may not be viewing in side by side windows, (2) the screen can be in any of three resolutions, (3) the screen can be portrait or landscape, (4) the browser may or may not be set to use the full space on the long dimension of the screen. OTOH, CSS Media Queries answer these questions.
- acheron 8y agoI have been having a shitty day and your comments in this article have honestly cheered me up a bit. Thank you!
- StavrosK 8y ago<3
- ducttapecrown 8y agoSo instead of sending a user agent, send only the page ratio!!
- rkeene2 8y agoThis is not too helpful -- you can resize the window in such a way that the ratio changes...
- minitech 8y agoI think CSS is probably good enough that we can live without UA sniffing for this.