<noscript><img /> in <head> valid?
Asked Answered
I

1

6

I'd like some advice on whether the following code is valid in the <head> section of a website:

<noscript><img src="http://bux1le001.com/images/track/26351.png?trk_user=26351&trk_tit=jsdisabled&trk_ref=jsdisabled&trk_loc=jsdisabled" height="0px" width="0px" style="display:none;" /></noscript>

I have been asked to add it to a website I look after but as far as I'm aware this means if JavaScript is disabled it will display an image to warn the user, but if I put it in the <head> section it won't work will it?

Icaria answered 23/5, 2014 at 8:38 Comment(1)
It's a tracker image, not something that's displayed to the user (note the width and height). As such the browser will probably load it even though the HTML is invalid.Pinnace
E
6

It is not valid (noscript elements are not allowed in the head before HTML 5, and may not contain images when they are in the head in HTML 5), but it will probably "work" as browsers perform a lot of error recovery. You might not get the DOM you are expecting though.

Eastman answered 23/5, 2014 at 8:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.