After applying client side validation on page, if browser JavaScript option has been disabled then all page validation/function are dead. So I need a JavaScript function, that automatically enables and disables JavaScript of any browser, it should run on my page and work on every browser.
Asked
Active
Viewed 204 times
-6
-
maybe throw in some code first? :) – kangoroo Aug 26 '13 at 09:57
-
There is no way you can get the browser settings be changed via scriping. But you can detect it. Please see : http://stackoverflow.com/questions/121203/how-to-detect-if-javascript-is-disabled – Roy M J Aug 26 '13 at 09:57
-
3Don't you think it could be a little security issue? – Andrea Casaccia Aug 26 '13 at 09:57
-
@Anubi: No i m looking for enabled js option by js function.if browser js option disabled,then it will enabled js option and set client side validation. – Abhishek Aug 26 '13 at 10:06
-
1Btw, that's one of the reasons why always need server side validation. Client side validation should only be used for improved UX, but it's not a security measure. – Felix Kling Aug 26 '13 at 10:09
-
@Abhishek I understand what you want to do. The security problem is that you cannot allow a web page to change user settings on a browser! – Andrea Casaccia Aug 26 '13 at 10:13
-
@Anubi:no more option – Abhishek Aug 26 '13 at 10:15
2 Answers
3
Your requirement is impossible to achieve. Among other considerations, how do you pretend to enable javascript in a browser where javascript is disabled using javascript?

Oscar
- 13,594
- 8
- 47
- 75
0
What you should do is detect that javascript is disabled and degrade your application to do validation in server side instead of client side.

Oscar
- 13,594
- 8
- 47
- 75
-
-
-
If i apply client side validation on my html page and if my mozilla browser js option disabled then, if i write some js function to enabled that checkbox,then is it possible or not? – Abhishek Aug 26 '13 at 11:13
-
No man, NO! It isn't possible! As I said, if js is disabled, you have to validate at SERVER SIDE. Forget about changing browser options, you can't! – Oscar Aug 26 '13 at 13:12