# How to: Check if Javascript is enabled

**URL:** <https://www.ruby-forum.com/t/how-to-check-if-javascript-is-enabled/178797>\
**Category:** Rails\
**Created:** [November 11, 2009, 2:27pm UTC](https://www.ruby-forum.com/t/how-to-check-if-javascript-is-enabled/178797 "2009-11-11T14:27:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tharrisx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19adc/32.png) [@tharrisx](https://www.ruby-forum.com/u/tharrisx)\
**Post date:** [November 11, 2009, 2:27pm UTC](https://www.ruby-forum.com/t/how-to-check-if-javascript-is-enabled/178797/1 "2009-11-11T14:27:53Z")

</div>

Hi there,

Rails has fantastic Javascript helpers, which I have immediately used  
for my website.

Since some features of my website now rely 100% on Javascript being  
enabled in the user’s browser, I now need a way to either:  
a) block the usage of the site when Javascript is disabled, or  
b) display a very visible message that tells the user to enable  
Javascript.

Has anybody good ideas for a plugin (or some other solution) to check if  
Javascript is enabled and to then let the user know?

(I know, a good programmer would let the site work without JS as well,  
but currently, I’m not there yet…)

Thanks a bunch for any help with this!  
Tom

---

<div class="post-metadata">

**Author:** ![tharrisx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19adc/32.png) [@tharrisx](https://www.ruby-forum.com/u/tharrisx)\
**Post date:** [November 11, 2009, 2:58pm UTC](https://www.ruby-forum.com/t/how-to-check-if-javascript-is-enabled/178797/2 "2009-11-11T14:58:49Z")

</div>

Quoting Tom Ha [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Javascript.
> 
> Has anybody good ideas for a plugin (or some other solution) to check if  
> Javascript is enabled and to then let the user know?

There is a tag in HTML that does what you want.

> **[HTML noscript tag](https://www.w3schools.com/TAGS/tag_noscript.asp)**
>
> W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

HTH,  
Jeffrey

---

<div class="post-metadata">

**Author:** ![tharrisx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19adc/32.png) [@tharrisx](https://www.ruby-forum.com/u/tharrisx)\
**Post date:** [November 11, 2009, 3:21pm UTC](https://www.ruby-forum.com/t/how-to-check-if-javascript-is-enabled/178797/3 "2009-11-11T15:21:37Z")

</div>

Tom Ha wrote:

> Hi there,
> 
> Rails has fantastic Javascript helpers, which I have immediately used  
> for my website.

Actually, Rails has terrible JS helpers: they encourage a poor style of  
programming where JS is mixed into HTML. Generally, this is not a good  
idea.

> Since some features of my website now rely 100% on Javascript being  
> enabled in the user’s browser, I now need a way to either:  
> a) block the usage of the site when Javascript is disabled, or  
> b) display a very visible message that tells the user to enable  
> Javascript.

The tag will work, or you could have a message in the HTML  
that your JS code will remove.

> Has anybody good ideas for a plugin (or some other solution) to check if  
> Javascript is enabled and to then let the user know?
> 
> (I know, a good programmer would let the site work without JS as well,  
> but currently, I’m not there yet…)

Get there! Read about progressive enhancement.

> Thanks a bunch for any help with this!  
> Tom  
> Best,  
> –  
> Marnen Laibow-Koser  
> [http://www.marnen.org](http://www.marnen.org)  
> removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![tharrisx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19adc/32.png) [@tharrisx](https://www.ruby-forum.com/u/tharrisx)\
**Post date:** [November 11, 2009, 5:05pm UTC](https://www.ruby-forum.com/t/how-to-check-if-javascript-is-enabled/178797/4 "2009-11-11T17:05:53Z")

</div>

🙂 Thanks, guys!

---

<div class="post-metadata">

**Author:** ![tharrisx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19adc/32.png) [@tharrisx](https://www.ruby-forum.com/u/tharrisx)\
**Post date:** [November 11, 2009, 3:48pm UTC](https://www.ruby-forum.com/t/how-to-check-if-javascript-is-enabled/178797/5 "2009-11-11T15:48:34Z")

</div>

On Wed, Nov 11, 2009 at 3:21 PM, Marnen Laibow-Koser  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > Has anybody good ideas for a plugin (or some other solution) to check if  
> > Javascript is enabled and to then let the user know?
> > 
> > (I know, a good programmer would let the site work without JS as well,  
> > but currently, I’m not there yet…)
> 
> Get there! Read about progressive enhancement.  
> +1  
> Not only for this, (because I think that using JavaScript in, almost,  
> the year 2010 is more than OK), but just because you have to.

–  
Leonardo M…  
There’s no place like ~
