Tuesday, 15 April 2014

html - Is an image within a noscript tag only downloaded if Javascript is disabled? -



html - Is an image within a noscript tag only downloaded if Javascript is disabled? -

consider next example:

<noscript> <img class="photo" src="example.png"> </noscript>

does client download image file if have javascript disabled? (i'm aware client can see image if javascript disabled in example)

the reason i'm asking because i've been using base64 info uris several background-image properties in external css (avoiding http requests). utilize base64 info uris src value of img tags updating values via external javascript (to retain benefits of caching).

essentially, whole point of avoid/limit http requests , wondering if can degrade gracefully , fetch image files if javascript disabled? or image downloaded regardless?

the html 4.01 specification says content of noscript not rendered in situations. however, suggests browsers should not perform operations on basis of content in such situations, since such operations pointless , cut down efficiency.

the html5 draft more explicit , reflects actual browser behavior. says noscript element, in emphatic note: “it works ‘turning off’ parser when scripts enabled, contents of element treated pure text , not real elements”. (the note relates why noscript not work when using xhtml syntax, reveals principle works, when works.)

so can expect when scripting enabled, content of noscript won’t parsed (except recognize end tag). blender’s reply seems confirm this, , little experiment firefox:

<img src=foo style="foo: 1"> <noscript> <img src=bar style="bla: 1"> </noscript>

firefox makes failing request foo no request bar, when scripting enabled. in addition, shows warning erroneous css code foo: 1, in error console, no warning bla: 1. apparently img tag not parsed.

however, don’t see how question relates scenario presented reason asking it. think utilize img element outside noscript , set there, using data: url, desired initial content (which remain, fallback, final content when scripting disabled).

html http background-image image noscript

No comments:

Post a Comment