html
/

HTML Noscript: Fallback for Disabled JavaScript

Last Sync: Today

On this page

8
0%
5 min read
Remaining
5 minleft

Click any section to jump — progress syncs automatically

html

HTML Noscript: Fallback for Disabled JavaScript

What is the Noscript Tag?

The <noscript> tag is used to display alternative content when JavaScript is disabled or not supported in the browser.

Basic Syntax

HTMLRead-only
1
<noscript>
  <p>Please enable JavaScript to use this site.</p>
</noscript>

Example with Script

HTMLRead-only
1
<script>
  document.write("JavaScript is enabled");
</script>

<noscript>
  <p>JavaScript is disabled.</p>
</noscript>

Usage in Head Section

The <noscript> tag can also be used inside the <head> to load alternative resources like CSS.

HTMLRead-only
1
<head>
  <noscript>
    <link rel="stylesheet" href="fallback.css">
  </noscript>
</head>

Common Use Cases

  • Display warning messages for disabled JavaScript
  • Provide alternative navigation or content
  • Load fallback styles or resources
  • Improve accessibility for non-JS environments

Best Practices

  • Provide meaningful fallback content
  • Ensure critical functionality works without JS if possible
  • Use noscript for essential messages only
  • Keep fallback content simple and clear

Common Mistakes

  • Ignoring users with JavaScript disabled
  • Providing no fallback content
  • Overusing noscript unnecessarily
  • Relying entirely on JavaScript for core functionality

Conclusion

The noscript tag ensures your website remains usable even when JavaScript is disabled, improving accessibility and reliability.

Try it yourself

<noscript>
  <p>Please enable JavaScript.</p>
</noscript>

Test Your Knowledge

Q1
of 3

When is noscript content shown?

A
When CSS fails
B
When JavaScript is disabled
C
When HTML fails
D
When browser crashes
Q2
of 3

Where can noscript be used?

A
Only body
B
Only head
C
Both head and body
D
Nowhere
Q3
of 3

What is its purpose?

A
Styling
B
Fallback content
C
Animation
D
Routing

Frequently Asked Questions

When is noscript used?

When JavaScript is disabled or not supported.

Can noscript be used in head?

Yes, for loading fallback resources.

Is noscript important?

Yes, for accessibility and fallback support.

Previous

html script

Next

html data attributes

Related Content

Need help?

Explore our comprehensive docs or start a chat with our tech experts.