views:

77

answers:

5

Hi,

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?

  • Option A: Just leave it be. If the site needs that much of Javascript, the user will realize the website won't be displayed and work properly without it...
  • Option B: Somehow detect if the browser has Javascript enabled and fully working and if it's not, show a message on screen sating the fact that the website can't be displayed properly without Javascript.
  • Option C: I'll leave that to you in case you have something to propose...
+1  A: 

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

graphicdivine
A: 

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/"&gt;Opera&lt;/a&gt; or
   <a href="http://getfirefox.com/"&gt;Firefox&lt;/a&gt;. Other JavaScript
   capable browsers are available.</p>
</noscript>
David Dorward
I disagree. Many modern web applications "need" javascript.
Ralph Stevens
Most sites are not web applications, and most web applications that "need" JavaScript could be written to avoid that requirement.
David Dorward
And of course you recommend me Opera or Firefox for my mobile phone? Or when I disable JS with NoScript in Firefox? Most browsers has can run JS this times. Those who can't are people who disable it by intention or mobile users who don't browse Internet on PC
MBO
@MBO I don't know what phone you use, but I would definitely recommend Opera for it if it is capable, it was great on my old Ericsson. As for JS being disabled, the first paragraph clearly mentions "and has it enabled". Yes, most browsers can run JS, two are listed for people who aren't using those browsers, the last sentence makes it clear that other options are out there. Some users will not be able to turn on JS and I refer you back to the first sentence of my answer; providing a "You need JS" message is very much a **last resort**.
David Dorward
+1  A: 

Put

<noscript>You really need to enable JavaScript to use this site</noscript>
S.Mark
A: 

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

Ralph Stevens
Or better: every standard functionality should be enhanced with JavaScript if it is possible.
MBO
A: 

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.

Nazgulled