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"
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"
Share edited Dec 12, 2010 at 17:45 IrishChieftain 15.3k8 gold badges52 silver badges95 bronze badges asked Dec 12, 2010 at 17:18 XaisoftXaisoft 46.7k87 gold badges285 silver badges444 bronze badges 1-
1
Afaik
<noscript>
isn't part of xhtml5 anymore since it doesn't play well with DOM. – CodesInChaos Commented Dec 12, 2010 at 17:35
5 Answers
Reset to default 5You 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.
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.
Check the <noscript>
HTML-Tag
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./p/enhancejs/
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. describing a work around for same purpose. You can check it out at http://www.codeproject./KB/aspnet/Detect_JavaScript_in_ASPX.aspx.