# HTML: Redirect a Page When JavaScript Is Disabled

> Redirect users who have JavaScript disabled using a noscript tag with a meta refresh directive, plus a fallback message example for those visitors

**URL:** https://sentry.io/answers/redirect-from-an-html-page-without-using-javascript/

---

## The Problem

You have a webpage that relies on JavaScript for functionality but you may have users that have JavaScript disabled in their browser. You want to redirect these users to a page that does not rely on JavaScript. How do you do this without using JavaScript?

## The Solution

You can add a [`noscript`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript) HTML element in the `head` element of your HTML, above any `script` tags. If JavaScript is disabled, the HTML between the `noscript` tags will be inserted into the page.

In the following example, if a user has disabled JavaScript, the contents of the page will be hidden using CSS and the user will be redirected to another URL using the [`meta`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta) HTML element:

```html
<noscript>
  <style>
    html {
      display: none;
    }
  </style>
  <meta http-equiv="refresh" content="0; url=https://www.bing.com/" />
</noscript>
```

Here, the `meta` element contains an HTTP-equivalent directive to "refresh" the page and the `content` attribute specifies the number of seconds until the page is reloaded. If the `content` attribute includes a valid `url`, the user will be redirected to it.

You can also use a `noscript` tag in the HTML `body` to show a message to the user if they have JavaScript disabled:

```html
<noscript>
  <p>
    This site is best viewed with Javascript. If you are unable to turn on Javascript, please use 
    <a href="https://www.example.com/your-no-js-page">this site</a>.
  </p>
</noscript>
```

---

*Source: [sentry.io/answers/redirect-from-an-html-page-without-using-javascript/](https://sentry.io/answers/redirect-from-an-html-page-without-using-javascript/)*
