1
votes

I performed a W3C HTML validation on a client's website and it's saying I have closed the header tag too early. This gives errors stating I have placed meta and link tags outside the header.

Can someone please advise what is wrong with my headers?

WARNING: Adult site NSFW

VALIDATION: http://validator.w3.org/check?uri=http%3A%2F%2Fwww.hush-hush.com%2F1stflick%2F&charset=%28detect+automatically%29&doctype=Inline&group=0&ss=1

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Nude Teen Videos | 1st Flick - Week 624</title>

    <script type="text/javascript">
        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-22415623-1']);
        _gaq.push(['_trackPageview']);
        (function() {var ga = document.createElement('script');
        ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(ga, s);
        })();
    </script>

    <meta name="google-translate-customization" content="c6d5b23c329fcd9b-06d3de73510dc63e-g0ea7962122bd05dd-11"></meta>

    <!-- Start Alexa Certify Javascript -->
        <script type="text/javascript">_atrk_opts = { atrk_acct:"9AYbi1acVE0008", domain:"hush-hush.com",dynamic: true};
            (function() { var as = document.createElement('script');
            as.type = 'text/javascript';
            as.async = true;
            as.src = "https://d31qbv1cthcecs.cloudfront.net/atrk.js";
            var s = document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(as, s);
            })();
        </script>
        <noscript>
            <img src="https://d5nxst8fruw4z.cloudfront.net/atrk.gif?account=9AYbi1acVE0008" style="display:none" height="1" width="1" alt="" />
        </noscript>
    <!-- End Alexa Certify Javascript -->

    <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
    <link rel="stylesheet" href="/css/screen.css" type="text/css" />
    <!--[if IE 6]>
        <link rel="stylesheet" type="text/css" href="/css/ie6.css" media="screen"/>
        <script defer type="text/javascript" src="/js/pngfix.js"></script>
    <![endif]-->
    <!--[if IE 7]>
        <link rel="stylesheet" type="text/css" href="/css/ie7.css" media="screen"/>
    <![endif]-->

    <script type="text/javascript" src="/js/script.js"></script>

    <link rel="alternate" title="Hush-Hush Galleries: News &amp; Updates" href="http://www.hush-hush.com/feed.xml" type="application/rss+xml" />
    <meta name="Description" content="1st Flick amateur teen video download. Submit vid to win password or cash."></meta>
    <meta name="KEYWORDS" content="movies, movie, video, videos, softcore, 1st Flick, teen, download, password, bedroom, amateur, adult, voyeur, downblouse, nipple, nipple slip, nip slip, upskirt, hidden camera, topless, celebrity nude"></meta>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>
</head>
<body>
...
3
The heck is that? a porn SITE? hahaha - Albert Laure
Porn people have problems too, I suppose. Do you have meta tags after the header is closed? - Matthew Johnson
hmm.looks very interesting.. - Vainglory07
@MatthewJohnson there are no meta tags after the header is closed. - Crazar

3 Answers

3
votes

<noscript> elements aren't permitted as children of <head> elements. They can only appear within <body> elements.

1
votes

Why don't you just move the <noscript> into the body?

1
votes

In HTML 4.01 (or XHTML 1.0) the noscript element must not be used in the head element.

In HTML5 it would be allowed:

The noscript element
[…]
Contexts in which this element can be used:
In a head element of an HTML document, if there are no ancestor noscript elements.

But note that if used in the head, it must not contain any other elements than link, style, or meta. So you cannot use the ìmg element as child.

In XHTML5 it’s not allowed.


Will the <noscript> tag prematurely close the header though?

Probably. If the parser finds a noscript element, it assumes that the body must have started. But of course it may be possible that everything works as intended (except for being invalid).

I assume that it should work fine to use your noscript in the body.