A Web Design Community curated by Chris Coyier

A little dab'll do ya

Code Snippets

Home » Code Snippets » JavaScript » Detect Javascript On/Off, With Notification Submit one!

Detect Javascript On/Off, With Notification

<script type="text/javascript">
   document.write("Welcome, you have Javascript on.")
</script>

<noscript>JavaScript is off. Please enable to view full site.</noscript>

If JavaScript is on the user gets a welcome message. If off, the user is instructed to turn it on.

Subscribe to The Thread

  1. You could also simply add a link with instructions on how to turn on JavaScript in the noscript tag.


    <noscript>For full functionality of this page it is necessary to enable JavaScript. Here are the <a href="http://www.enable-javascript.com&quot; target="_blank"> instructions how to enable JavaScript in your web browser</a></noscript>

  2. Mani says:

    @Toni Podmanicki Thanks for the useful link

  3. amit mojumder says:

    Nice snippet. Thanks for sharing.
    But, isnt it supposed to show the notification on a pop up instead of site upper header?

    Thanks

It's Your Turn

At this moment, you have an awesome opportunity* to be the person your mother always wanted you to be: kind, helpful, and smart. Do that, and we'll give you a big ol' gold star for the day (literally).

Posting tips:
  • You can use basic HTML
  • When posting code, please turn all
    < characters into &lt;
  • If the code is multi-line, use
    <pre><code></code></pre>
Thank you,
--- The Management ---