Hacker News new | ask | show | jobs
by grishka 1801 days ago
Having to request it is a terrible idea to begin with. If I want to use different templates for mobile vs desktop, I need to know, on the backend, whether the device is a mobile device, and I need it on the very first request. Having to request these headers explicitly is an unnecessary complication that would slow down the first load.

However it is nice that there's now a separate header that gives a yes or no answer on whether it's a mobile device.

1 comments

Why would you need different templates for mobile/desktop? CSS is quite capable responding to any screen orientation.
Yes it is. Except you can't use the same markup for both because the input devices, and thus interaction paradigms, are so radically different. Mice are precise and capable of hovering over things, so it makes sense to pack everything densely and add various tooltips and popup menus. Touchscreens are imprecise and don't have anything resembling hovering, so UI elements must be large, with enough padding around them, and with menus appearing on click.
Between CSS Flexbox and CSS Grid there shouldn't any reasons today that you can't handle 100% of those differences with the same markup and media stylesheets. (There's also obviously JS if you really must contort the HTML DOM to get what you want.)
You're not wrong. However, there are times when CSS isn't enough. For example:

- The Mobile vs Desktop design differences are too great.

- The site was originally created without considering mobile, and retrofitting mobile support is unfeasible.

Can you expand on the design differences?