2017  Kodetalk | Feedback | Privacy Policy | Terms | About

How to detect if JavaScript is disabled?

How to detect if Javascript is disabled?

If its disabled so that i can send a  warning that the site is not able to function properly without the browser having JS enabled, eventually I would want to redirect them to content that is able to work in the abscence of JS, but I need this detection as a place holder to start.


I assume that you're trying to decide whether or not to deliver JavaScript-enhanced content. The best implementations degrade cleanly, so that the site still operates without JavaScript. I guess that you mean server-side detection, rather than using the <noscript> element.

There isn't a good way to perform server-side JavaScript detection. Instead, use JavaScript to set a cookie, and then test for that cookie using server-side scripting upon subsequent page views; deliver content appropriately.

Answer is