# Non-space character inside “noscript” inside “head”.

> Canonical HTML version: https://rocketvalidator.com/html-validation/non-space-character-inside-noscript-inside-head
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

A `<noscript>` inside the `<head>` contains text, but there it may only hold `<link>`, `<style>` and `<meta>` elements.

The `<head>` is never rendered, so a `<noscript>` placed there can only change metadata, for example by loading a fallback stylesheet. Whitespace and comments are fine. Any other character counts, including `&nbsp;`, because a non-breaking space isn't whitespace to the HTML parser.

When JavaScript is off, the parser treats that text as the start of the page content. It closes the `<noscript>` and the `<head>` early and opens the `<body>` there. The text and everything after it end up in the body, which is why the validator usually follows this error with `Stray end tag “noscript”`, `Stray end tag “head”` and a complaint about a second `<body>` start tag. Any `<meta>` or `<link>` that comes after the `<noscript>` also lands in the body.

A message for visitors without JavaScript belongs in a `<noscript>` inside the `<body>`. Keep the `<noscript>` in the `<head>` for metadata only, or remove it.

## Invalid example

```html
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Example</title>
    <noscript>Please enable JavaScript to use this site.</noscript>
  </head>
  <body>
    <p>Hello</p>
  </body>
</html>
```

## Valid example

```html
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Example</title>
    <noscript>
      <link rel="stylesheet" href="no-js.css">
    </noscript>
  </head>
  <body>
    <noscript>
      <p>Please enable JavaScript to use this site.</p>
    </noscript>
    <p>Hello</p>
  </body>
</html>
```
