[whatwg] RWD Heaven: if browsers reported device capabilities in a request header

Matthew Wilcox mail at matthewwilcox.com
Mon Feb 6 08:27:29 PST 2012


I disagree. Screen size is at times *exactly* what is needed, as it *is*
constant throughout the experience. *Viewport* size is what we shouldn't be
using. I've ran up against this with Adaptive Images (
http://adaptive-images.com ) - which is all about the use case of supplying
appropriate images to given devices.

The problem with using viewport instead of device size is client-side
caching. It completely breaks things. As follows:

1) The user requests the site with a viewport at less than the device
screen size.
2) The user browses around for a bit on a few pages.
3) The user maximises their browser.
4) All of the images now in the browser cache are too small.

How does the client know to re-request all those pre-cached images, without
making an arduous manual JS-reliant cache manifest? Or without turning off
caching entirely?

The solution is to send an image that is as large as the device will ever
need, not for the current viewport.

Yes, this isn't ideal, but it solves the problem and it solves it very well
for small devices whilst maintaining client-side caching. There's very
little difference in file weight between an image 320px wide and one 480px
wide, so the overhead of supporting landscape even if you're currently only
at portrait isn't anywhere near as great as un-negotiated content. Nor does
it require new HTTP requests on orientation change, which would be a
terrible experience whereby the page that WAS readable suddenly ends up
re-flowing and re-loading assets just because you've increased the window
size.



On 6 February 2012 16:00, Boris Zbarsky <bzbarsky at mit.edu> wrote:

> On 2/6/12 10:52 AM, Matthew Wilcox wrote:
>
>> 1) client asks for spdy://website.com
>> 2) server responds with content and adds a "request bandwidth&  device
>> screen size header"
>>
>
> Again, the "screen size" is not invariant during the lifetime of a page.
>  We should not be encouraging people to think that it is....
>
> -Boris
>



More information about the whatwg mailing list