-4

Possible Duplicate:
How to detect if JavaScript is disabled?

if i am disable my javascript from browser settings, its stopped working, do i know the best way to recommend the user to enable its broswer javascript if by default it has off ? Any help ? or how can my code will detect of the javascript is off from browser or not :/ Any help ?

Community
  • 1
  • 1

3 Answers3

2

Use <noscript> tag. And add some info in this tag. This display when user has enabled javascript.

Mateusz Rogulski
  • 7,357
  • 7
  • 44
  • 62
0
<noscript>
This page requires JavaScript, please turn it on.
</noscript>
Barmar
  • 741,623
  • 53
  • 500
  • 612
  • `how i can disable my table if the `javascript` is disabled from settings of `browser` ? any help ? Currently some `dropdown` is working with `javascript`, if i made it OFF from `Settings`, they soon did not worked out, i need to disable the same table on the same time ? Any possibility ?` – user1859847 Dec 29 '12 at 08:29
  • Anything that works using just HTML and CSS will still work without JS. You can load a different stylesheet inside the ` – Barmar Dec 29 '12 at 08:36
0

If you for some reason don't want to use the <noscript> tag, or if you want to do the reverse (show some content only if JavaScript is enabled), you can make an element hidden by default (set display:none; through CSS). Then you have a small JavaScript add an additional-class to the element, say js-enabled. You can then you have a CSS-rule:

.js-enabled {
   display: block;
}

When your JavaScript applies the class, the element will become visible. If the user doesn't have JavaScript enabled, the class will not be added and the element will stay hidden.

Christofer Eliasson
  • 32,939
  • 7
  • 74
  • 103
  • `.js-enabled { display: block; }` I just need to disable the block untill the user did not enable the Ajavascript option. Its not working well. – user1859847 Dec 29 '12 at 08:39
  • @user1859847 Not sure I understand why this doesn't work? Set `display: none;` on all elements you want to show only to those who have JavaScript enabled. Then you write a small piece of JavaScript like the above, that attaches the `js-enabled` class to those elements, to re-display them to users with JavaScript. If this isn't what you are looking for, I believe you have to update the question with additional information to clarify what you are looking for. – Christofer Eliasson Dec 29 '12 at 08:52