0

If an user has installed the JavaScript plug-in but is disabled (for security reasons, etc. using no-script or something similar) is there a way to auto-detect (with code, you could suggest the language) that you have JS BUT disabled? If so, switch automatically to the HTML version of the page.

I saw some posts (How to detect if JavaScript is disabled?) but I'm willing to do the switch automatically. Not printing a message saying that "you not have JS enabled" or so on (also, the solution for that question, is the most probable?).

(currently I'm not coding, just asking for general culture question)

Community
  • 1
  • 1
  • doesn't everyone (except for a very few) have JavaScript? I think it is safe to assume a user doesn't have it, it actually has it disabled. – Rene Pot Feb 01 '12 at 12:40
  • `noscript` element not doing it for you? – alex Feb 01 '12 at 12:40
  • I do have it. But is disabled 70% of my surfing time for security reasons. The other 30% is when I'm in youtube or 9gag. Maybe the scope is reduced, yes; but just screening the possibilities. –  Feb 01 '12 at 12:42

3 Answers3

1

The standard approach to this is to serve up the HTML version of the page by default, then use JavaScript to layer extra functionality on top.

This is known as progressive enhancement and is a core part of unobtrusive JavaScript.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
0

No. If the browser does not want to expose this capability (e.g. disabled, disabled through add-on) you cannot detect it.

<noscript> tag is all you have.

https://developer.mozilla.org/en/HTML/Element/noscript

Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
0

It has a mention of <noscript>...</noscript>. Use that.

shadyabhi
  • 16,675
  • 26
  • 80
  • 131
  • I'm pretty sure that using the NoScript browser extension will not cause the browser to render ` – Quentin Feb 01 '12 at 12:43