Detect Javascript on Form Submission

There are many different ways to detect whether javascript is enabled or disabled. <noscript> is probably the semantically best way and can be embedded in many different contexts.

However, I discovered a nice approach to detect if javascript is enabled on form submission. Amazon.com makes also use of it and I am suprised by the simple and clean implementation:

<noscript><input type="hidden" name="hasWorkingJavascript" value="0"></noscript>

Simple and straight forward. By this, you can check on the backend if the input was set and act accordingly. For example, you could embed this to your login page and thereby deliver a specific implementation which workes without javascript or display a message like 'JS is required'.

Leave a Comment

comments powered by Disqus