W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2012

Re: [whatwg] Responsive images using http headers

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Mon, 25 Jun 2012 14:10:24 -0400
Message-ID: <4FE8A990.2020206@mit.edu>
To: whatwg@lists.whatwg.org
On 6/25/12 1:34 PM, Oscar Otero wrote:
> For example, for an image 100% width in a div of 400px, the browser
> would send a header indicating it need a 400px width image.

The problem is that the browser typically does not know the following 
pieces of information when it sends the image request:

1)  The styles of the image.
2)  The parent of the image (or even whether the parent is unique;
     image loads are coalesced if the same URL appears in the page
     multiple times).

It could have that information available if it waited a lot longer to 
request images [1], but right now browsers try to kick off requests as 
soon as they can.  For example in this example:

   <!doctype html>
   <link rel="stylesheet" href="something.css">
   <img src="whatever">

browsers will currently start loading the image before the stylesheet is 
done loading.  With your proposal they would have to stop doing that, right?

-Boris

[1] Though in cases like this:

   <table width="200px">
     <tr>
       <td>
         <img src="img1" style="width: 100%">
       </td>
       <td>
         <img src="img2" style="width: 100%">
       </td>
     </tr>
   </table>

the actual layout width of either image can't be determined until the 
intrinsic size of both images is known.  There are lots of other cases 
like this involving flexbox, floats, etc, etc.

-Boris
Received on Monday, 25 June 2012 18:11:00 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:43 UTC