4

If I have a website that makes use of javascript and the user will get the most full experience of the website if they have javascript enabled, but it would still be fully functional even if javascript was disabled. Is there a way to check if the user has javascript disabled for the browser they are using, so I can display a message of something like: "The website is best viewed with javascript enabled"

1
  • 1
    Afaik <noscript> isn't part of xhtml5 anymore since it doesn't play well with DOM. Commented Dec 12, 2010 at 17:35

5 Answers 5

5

You could use the <noscript> tag:

<noscript>
    The website is best viewed with javascript enabled
</noscript>

You may also take a look at this article about unobtrusive javascript.

Sign up to request clarification or add additional context in comments.

Comments

1

Use the HTML <noscript> tag in your view to display alternate content. Content between <noscript> and </noscript> will only be displayed if the browser has no JavaScript support or has JavaScript disabled.

Comments

0

Check the <noscript> HTML-Tag

2 Comments

Is this the only option available to create extra markup between noscript tages?
I don't get your question. Do you mean if there is an alternative to <noscript> ? If so, have a look at the article referenced by Darin Dimitrov.
0

The proper way to do this is to use Progressive Enhancement. Have a basic markup file that will work across all browsers. Then apply your JavaScript to browsers that understand JS emitted by a test suite:

http://code.google.com/p/enhancejs/

Comments

0

In ASP.Net we have Request.Browser.JavaScript in order to check whether browser support Javascript or not not but it does not check whether disable or enable.

There is an article on codeproject.com describing a work around for same purpose. You can check it out at http://www.codeproject.com/KB/aspnet/Detect_JavaScript_in_ASPX.aspx.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.