Re: Title of the spec may cause heartache


Could this double-download be mitigated by wrapping the <img> tag with <noscript>?

Something like this:
<img srcset=“book.jpg 1x, book-HD.jpg 2x”>
<img src=“book-default.jpg”>

Seems to me like:

 *   If JS is enabled, no browser will preload book-default.jpg (I haven’t tested it, but it’s hard to believe this isn’t the case)
 *   On old browsers (that don’t support srcset)
    *   If JS is enabled, the polyfill will make the srcset attribute work, and can delete the <noscript> element if desired
    *   If JS is disabled, book-default.jpg will be loaded (and perhaps even preloaded)
 *   On new browsers (that support <picture>)
    *   If JS is enabled, they’ll simply use the srcset attribute
    *   If JS is disabled, they’ll break

In other words, you’re trading double-downloading on all non-picture browsers (which for a good while will include, for example, the vast majority of mobile traffic) for broken pages on new browsers with JS disabled.

My apologies if I’m missing something obvious or am making a wrong core assumption here.


Guy Podjarny | Akamai CTO, Web |<> | @guypod<>

From: Yoav Weiss <<>>
Date: Tuesday, September 23, 2014 at 11:33 AM
To: Bruce Lawson <<>>
Cc: Attiks <<>>, John Albin Wilkins <<>>, Christopher Schmitt <<>>, Jason Grigsby <<>>, Odin Hørthe Omdal <<>>, "<>" <<>>
Subject: Re: Title of the spec may cause heartache
Resent-From: <<>>
Resent-Date: Tuesday, September 23, 2014 at 11:34 AM

@attiks - if you use <img src> with an old browser, you'd have a double download, regardless of using <picture> or srcset, if you're using picturefill..
so, if you are using a polyfill, and want to avoid the double download, just omit the src attribute in either case.

In any case, that's irrelevant to the "picture or srcset" question.

On Tue, Sep 23, 2014 at 7:24 AM, Bruce Lawson <<>> wrote:
On 23 September 2014 13:51, Attiks <<>> wrote:
> We're using picturefill that adds support for srcset as well, so you'll get
> both.

ah, well, I didn't know that. That's nothing to do with new responsive
images in browsers, though.


Received on Tuesday, 23 September 2014 15:57:19 UTC