Possible Duplicate:
How to detect if JavaScript is disabled?
My first web application relies heavily on Javascript and AJAX application.
Other than my Login Page, majority of the pages relies on Javascript and Ajax when submitting data to the server. I have been thinking about this, if user disables his/her javascript then my app does not behave accordingly.
I used this code in my Login page
<NOSCRIPT>
Javascript is required to run this pages. Please turn it on or ask help from techsupport if you dont know how to enable it
</NOSCRIPT>
Although I think not relevant, I used Spring MVC 2.5 and Jquery for the sake of information to all.
Any thoughts how others are able to handle in scenario such as this?
I think it's fine to require JavaScript to run your application. All mainstream web browsers have it today, and have had it for the last 10 years.
Using a <noscript>
tag is an acceptable way of showing to the user that they need JavaScript. I don't understand what you meant about disabling the login button though... You used JavaScript to detect if JavaScript was disabled ("I used jquery to check for the presence of this tag")?
What you should do is to have the login button disabled by default, then use JavaScript (jQuery) to enable it. That way it will only be enabled if the user has JavaScript enabled.
What you should do is something like so
<noscript>
<meta http-equiv="refresh" content="url=/?nojs=true">
</noscript>
This will do a html immediate refresh as soon as the headers are parsed allowing you to do something a little different.
Server Side: (PHP in my case)
if(isset($_GET['nojs']) && !isset($_SESSION['no_script']))
{
$_SESSION['no_script'] = true; //Or cookie
}
Then as you have the variable locked in session / cookie you can throw out different pages for non JavaScript users.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With