Forum Moderators: open

Message Too Old, No Replies

Testing to see if user has JS enabled

By using a hidden field

         

Jeremy_H

11:57 pm on Mar 10, 2006 (gmt 0)

10+ Year Member



I'm writing a form that uses JavaScript as the first level of authentication of input values.

Therefore, I'm interested in knowing if people that fill out the form have JavaScript enabled.

I'm thinking of using some code like below, but I noticed that even if I have JavaScript disabled, I still get "yes". Therefore its giving me some false positives.

Any idea how I can do this better? I'm using PHP if its of any consequence.

Thanks

<script type="text/javascript">document.write("<input type='hidden' name='js' value='yes'>")</script>

Key_Master

12:18 am on Mar 11, 2006 (gmt 0)

Bernard Marx

12:42 am on Mar 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



but I noticed that even if I have JavaScript disabled, I still get "yes".

I can't see how that can happen with JS disabled.

Fotiman

12:57 am on Mar 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Unless, of course, you had javascript enabled when the page loaded, but disabled when you submited the form.

Bernard Marx

2:19 pm on Mar 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Indeed.