igrigorik / http-client-hints

402 stars 24 forks source link

"Request desktop site" Width Exception on Mobile? #53

Closed hexalys closed 9 years ago

hexalys commented 9 years ago

Mobile browsers now all have a "Request desktop site" feature, either on per page basis (like Safari or Chrome) or globally across the browser (like Opera), which changes the User Agent to a desktop one. When enabled, the user intent is to expect a desktop or tablet size layout when available, as opposed to a responsive device-with.

The desktop (non responsive) default viewport being 980px in webkit or 1024px in IE Mobile.

Should client hints indicate a Width and Viewport-Width of that size instead of the responsive viewport?

I am not arguing either way, though leaning towards exposing that default viewport.

Just want to bring the use case ahead of time, for the appropriate approach to take for mobile browsers in that feature's context. And make sure that all browsers follow the same standard down the road, and not inventing their own different ones.

igrigorik commented 9 years ago

"Request desktop site" does not change what the browser reports as its viewport. AFAIK, the only difference is that it sends a different UA string. Perhaps it should, but that's a whole separate conversation that's out of scope in this context.

Values reported by CH match the values seen by JS/CSS in the page. As such, if at some point this feature changes to report "fake" viewport values, then CH will inherit that. At the moment we report the same values regardless of "request mode".

In other words, I think this is a no-op for CH.

hexalys commented 9 years ago

Values reported by CH match the values seen by JS/CSS in the page.

Not entirely. As the spec example mentions: it's an "intended display width of requested resource". In that scope, the value implied is relative to the meta viewport and its settings, and on Mobile, the assumption that the site will use device-width.

Mobile device-width is unique, but viewport width and width are not. Similarly to "Request desktop site", if CH reports a RWD Viewport Width, as currently implied, it's technically an intent value. Not the one processed by JS early in the <head>.

Maybe it's more of an implementation issue. But in the sense that CH is supposed to be "data that can be used by the server to select an appropriate response". I think this is worth addressing. Because in a "Request desktop site" case, the appropriate server response on a phone is more like 980 than it is 320.

hexalys commented 9 years ago

If not in the RFC. Please consider treating the above case in the implementation consideration document for @yoavweiss as mentioned at https://github.com/igrigorik/http-client-hints/issues/41#issuecomment-112176792

igrigorik commented 9 years ago

on Mobile, the assumption that the site will use device-width.

Viewport-Width reports the layout viewport as set by the site: if they set it to device-width then that's what we'll report, if they leave it as default value then we'll report whatever UA sets it to.

p.s. afaik, "request as desktop site" is not a formally defined feature with any well-formed processing model, as such I'd block this discussion on resolving that first.. but that's out of scope for CH. If and when that becomes a thing, we can revisit in the context of CH and other relevant specs.

igrigorik commented 9 years ago

Closing, feel free to reopen if there is more to discuss here :)