i am having a application in which java script is must. but i am facing problem when at any client browser has java script disabled. i want a code using which i can check the browsers java script enabled/ disabled property so that the user cannot login until he enables javascript. can anyone help me in this code
2 Answers
You could simply have the "log in" button disabled by default and have it enabled by JavaScript when the document is loaded.
Also put a message saying the JavaScript is disabled on a page and make it visible by default. Upon document load, hide the message. Alternatively, use the <noscript> tag.
6 Comments
roman m
way to think out of the box :) +1
Sumit Gupta
but i need to give user a message about java script disable. otherwise he might not know what to do.
roman m
I'd also have a message directing a user to enable JS, which would be disabled by JS on page load
roman m
@Sumit Gupta: have the message show up by default, and then hide it as you show the login button with JS.
eglasius
+1 @Sumit accept the answer, this is the way it should be done. Checking at the server side isn't reliable. As mentioned in the answer, use the <noscript> tag for whatever message you want to show to the user when javascript is disabled.
|