

Ask HN: Image Negotiation - alexchamberlain

Hi all,<p>Is there any way for a browser to negotiate image size with the server?<p>A lot more sites are now being designed using responsive techniques. This may lead to images of various sizes being need. One way of doing this is to embed a few IMG tags and then set display:none on all but the img you want. However, this means the client will download all of the images, most of which won't be displayed.<p>The size of the image can be calculated by the browsers, provided style="width: x; height: y" is set (probably within a media query somewhere) and this could be sent up using a header. I think the most appropriate would be the Accept-Features header, but it doesn't seem like it is supported.<p>Is this possible now? Will it become possible? Thoughts please.
======
mooism2
Can you do

    
    
        <span id="whatever">&nbsp;</span>
    

and then set width, height _and_ background-image in the css using media
queries?

I don't know whether clients will download all the images or just the one
needed.

