About This HTML Issue
The “Stray start tag noscript“ error in the W3C HTML Validator indicates that the <noscript> tag has been used incorrectly or is placed in an invalid location within your HTML document.
The <noscript> tag is used to define alternative content for users who have disabled JavaScript in their browsers or for browsers that do not support JavaScript.
Common Causes:
-
Position of
<noscript>: The<noscript>tag should be placed correctly within sections where it is allowed. -
Nested Improperly: The
<noscript>tag should not be placed inside other tags where it is not valid.
Correct Usage:
-
Within
<head>:<head> <title>Example Page</title> <script> // Some JavaScript code </script> <noscript> <style> /* Alternative styling if JavaScript is disabled */ </style> </noscript> </head> -
Within
<body>:<body> <h1>Welcome to the Example Page</h1> <script> // Some JavaScript code </script> <noscript> <p>JavaScript is disabled in your browser. Please enable JavaScript for the full experience.</p> </noscript> </body>
Fixing the Issue:
-
Inside Existing Tags: Ensure the
<noscript>tag is not placed inside other tags where it cannot be parsed correctly.<!-- Incorrect --> <div> <noscript> <p>JavaScript is disabled in your browser.</p> </noscript> </div> <!-- Correct --> <noscript> <div> <p>JavaScript is disabled in your browser.</p> </div> </noscript> -
Placement in Body or Head: Verify that the
<noscript>tag is placed inside the<body>or<head>based on what content it’s providing a fallback for.<!-- Incorrect (inside an illegal tag) --> <div> Some content <noscript><p>JavaScript is disabled in your browser.</p></noscript> </div> <!-- Correct --> <div>Some content</div> <noscript><p>JavaScript is disabled in your browser.</p></noscript>
Summary:
-
Place
<noscript>only within accepted sections (<head>or<body>). -
Avoid nesting
<noscript>inside other tags improperly.
Learn more:
Last reviewed: September 19, 2024
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.