rfgamaral
rfgamaral

Reputation: 16842

Prevent access to Javascript based website or

Some websites I develop have a great need for the use of Javascript, they will not work without it. Lots of the site functions and actions depend on some Javascript code that cannot be replaced by server-side code. Sometimes, the Javascript is so complex and needed that it's impossible to provide a fallback for browsers with Javascript disabled.

In this context what would be the right way to handle the situation?

Upvotes: 0

Views: 1700

Answers (5)

rfgamaral
rfgamaral

Reputation: 16842

I'm doing this here because everyone has said basically the same thing and you can comment on what I'm going to say if you like...

I'm not going to use the noscript tag because everything else on the site will still be displayed. I'll manage a different way to detect if Javascript is enabled or not and maybe redirect the browser to a specific page. I don't know exactly how am I going to do it yet, but I'm going with this concept.

Of course most if not all websites can work with Javascript but I'm developing this web app which uses a lot of Javascript and yes, it could work without it, but it wouldn't be the same thing. It would be like comparing a finished and polished site (Javascript enabled) with one still in the early stages of development (Javascript disabled).

And yes, I want to completely shut off the user from the website if Javascript is disabled. Shouldn't I do that? Maybe not, but for this specific site, I will. For this specific web app, degrading gracefully it's unacceptable. My own requirement not some client's, just to make sure of that.

But maybe I won't do it like I said above I would, that will actually depend on all the Javascript code I need. I actually started developing this app long time a go but I had to put it on standby and now, since it's been too long, I'm going to start from scratch. I'll see if I want to make it work degrading gracefully or not...

This was just to clarify my intentions on the comments you guys made.

After this, I'm going to mark the first answer has the accepted one because they are basically all the same.

Upvotes: 0

stepanian
stepanian

Reputation: 11433

Definitely not A. At least Option B. Preferably, every javascript functionality should degrade gracefully (without causing errors) to pure HTML.

Upvotes: 0

YOU
YOU

Reputation: 123851

Put

<noscript>You really need to enable JavaScript to use this site</noscript>

Upvotes: 1

Quentin
Quentin

Reputation: 943696

It is very rare that a site really needs JavaScript (not unheard of, but rare). In those cases where that is the case, go with option B.

<noscript>
   <p>Sorry, but this website depends on JavaScript. 
   Please ensure you are using a browser which supports
   JavaScript and has it enabled.</p>

   <p>We recommend <a href="http://opera.com/">Opera</a> or
   <a href="http://getfirefox.com/">Firefox</a>. Other JavaScript
   capable browsers are available.</p>
</noscript>

Upvotes: 0

graphicdivine
graphicdivine

Reputation: 11211

Option B. Use the noscript html tag to alert your users.

Upvotes: 1

Related Questions