4 ms·
Because clients don't send this information to the server (and if they did, its validity would be suspect), and because browser layout engines and CSS are alrea
by cheald 13y ago
Because clients don't send this information to the server (and if they did, its validity would be suspect), and because browser layout engines and CSS are already designed to be independent of specific device metrics. It's a solution to a problem that doesn't need solving.
- benatkin 13y agoIt sends the User-Agent, which can be used to determine whether it's the desktop or not. It doesn't solve the portrait and landscape changing problem. So some client-side responsive design would still need to be used. I think a hybrid approach would be too tedious for someone developing a website to do, in order to get the payoff of sending less to mobile browsers, but it may be worth implementing in a framework.
- cheald 13y ago1) User agents lie. Frequently. 2) A user agent doesn't encode any information about the actual metrics of the device. Doing layout by user agent is basically a worst-case hellhole of browser-specific codebase fragmentation. There's a very good reason why best practices have been trending away from "test for vendor class" and towards "test for agent capabilities".
- benatkin 13y agoWell a sufficiently complex framework could deal with it, by making another trip to the server if it discovers the code being sent down the first time isn't good enough.
- martin-adams 13y agoThe fact that I'm on a desktop does not take into account that my browser window may be smaller than my 'desktop screen'. Responsive is the way to go because it works.
- untog 13y agoIt sends the User-Agent, which can be used to determine whether it's the desktop or not. What is "desktop"? An MS Surface Pro would report as a desktop browser, but it's a touch interface. You can also resize the browser window- what then? So some client-side responsive design would still need to be used. Which is the point. The server can't know conclusively so why make it try?
- nostrademons 13y agoCSS3 media queries can often fulfill the missing link for screen sizes, aspect ratios, etc. http://www.w3.org/TR/css3-mediaqueries/ http://www.w3.org/TR/css3-mediaqueries/
- antsar 13y agoI didn't mean to imply that this is possible with technology we have at the moment. A piece of JavaScript code (framework, perhaps) could surely send the needed data, and for those with JS disabled, the page could fail over to using media queries (to be exact, it would need to load the media query version the first time your site is loaded, but could immediately redirect to the lighter JS version if you have JS enabled and the light/JS version would be loaded for future requests).