3 ms·
if browsers would stop lying about dpi, we wouldn't need to guess trough UA wheter something is a low res desktop, a high resolution small monitor or something
by avereveard 5y ago
if browsers would stop lying about dpi, we wouldn't need to guess trough UA wheter something is a low res desktop, a high resolution small monitor or something in between (and let's not start talking about browser windows that aren't fullscreen).
once we could at least use the availability of touch features to guide between the cases, but now that one started lying as well.
we parse user agent not because we like to but because the absolute shitshow that's the metrics system on browsers.
- undecisive 5y agoYeah. To some extent, that's outside the browser's hands - if the system doesn't know what the "real world pixel size" is (insert obligatory "of course I know pixels don't exist" disclaimer here) then there's no way to pass that information on to the browser. Complete side note, I'm shocked at how terribly Linux is still doing at the whole hi-dpi vs lo-dpi vs everything in between. But yes, generally speaking the gold standard is CSS rems - it presumes that a user has somewhat configured their machine comfortably, mind. But if you use that text size as a relative measure for all the text on their screens, you can scale your interface elements knowing that if 1rem is a good readable size for a letter, all headings etc should be bigger, no interactive element should ever be smaller than 1rem (and should probably be a fair bit bigger on mobile devices), you can define margins around this measure too. It isn't perfect, but it'll beat UA most of the time. You'll stop worrying about the definition of high res and low res, and instead focus on the comfort of the individual - which might be a bespectacled octogenarian or an impoverished student on the same system.