Re: Title of the spec may cause heartache

On Tue, 23 Sep 2014 17:54:55 +0200, Podjarny, Guy <gpodjarn@akamai.com>  
wrote:

> All,
>
> 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”>
> <noscript>
> <img src=“book-default.jpg”>
> </noscript>
>
> 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)

It will also show the alt text for the img outside <noscript>, which is  
bad.

>  *   On new browsers (that support <picture>)
>     *   If JS is enabled, they’ll simply use the srcset attribute
>     *   If JS is disabled, they’ll break

This last point is bad and is permanent. Double download is a temporary  
problem.

> 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.

A consideration you're missing but Yoav mentioned is that there can be  
other reasons for JS to not run other than the user having disabled JS in  
the browser. <noscript> doesn't help for those cases.

In conclusion, I would recommend against using <noscript> (for this in  
particular but also in general).

-- 
Simon Pieters
Opera Software

Received on Wednesday, 24 September 2014 08:14:17 UTC