Reputation: 46651
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"
Upvotes: 4
Views: 5396
Reputation: 1039508
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.
Upvotes: 5
Reputation: 960
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.
Upvotes: 0
Reputation: 15252
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/
Upvotes: 0
Reputation: 4403
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.
Upvotes: 1