Nistor Alexandru
Nistor Alexandru

Reputation: 5393

Validator says "Stray end tag script", but I don’t use script on my page

I am getting a weird error on the W3C HTML validator:

Line 167, Column 74: Stray end tag script. …ipt type="text/javascript" src="http://stats.hosting24.com/count.php"></script>

Line 167, Column 74: Cannot recover after last error. Any further errors will be ignored. …ipt type="text/javascript" src="http://stats.hosting24.com/count.php"></script>

The weird thing is, I have no line 167. My document ends on line 165 and there are no script tags on the page. Also there is no count.php file.

Anyone know how to fix this?

EDIT: W3C validator link

Upvotes: 1

Views: 3052

Answers (3)

Olivier
Olivier

Reputation: 11

It's added automatically by your hosting provider. I have exactly the same problem. But I don't think there is a solution to the problem. It's added automatically by your hosting provider. Also Javascript won't work:

1) The validator won't use it because it's definitely loading AFTER the page has loaded.

2) The code is outside the DOM, which means that you can't reach it with javascript.

Hope you have some information on this.

Upvotes: 1

Tom
Tom

Reputation: 311

You're using HTML code after you've closed the HTML tag telling the browser there will be no more HTML. Could have been added by your hosting provider if you didn't do it yourself. Edit the page, place the analytics script inside the HEAD of the document then revalidate.

Upvotes: 1

sachleen
sachleen

Reputation: 31131

The script tag is outside of the BODY tag. It needs to be inside. Putting the script tag right before the closing </body> tag results in successful validation.

Won't work:

        </div><!--div#footer-->

    </body>
</html>

<!-- Hosting24 Analytics Code -->
<script type="text/javascript" src="http://stats.hosting24.com/count.php"></script>
<!-- End Of Analytics Code -->

Works:

        </div><!--div#footer-->
        <!-- Hosting24 Analytics Code -->
        <script type="text/javascript" src="http://stats.hosting24.com/count.php"></script>
        <!-- End Of Analytics Code -->
    </body>
</html>

Upvotes: 2

Related Questions