programmatically detecting javascript enabled


I need a way of detecting in my code behind if possible if javascript has been enabled or disabled.

There seem to be lots of examples of detecting if a browser is capable but I need to know if it is actually switched in or out.

Any ideas?
Who is Participating?
dxdinhConnect With a Mentor Commented:
or to simplify the code within 1 second redirect


<meta http-equiv="refresh" content="1; URL=RedirectPageHere.html">


F IgorConnect With a Mentor DeveloperCommented:
There is no difference between javascript when it's not enabled and when it's not supported. You can use the <NOSCRIPT> </NOSCRIPT> tags to put some code, message, or alert to the user that it's not enabled/supported.

I'm not sure if exists some browser specific function to detect this feature,
because whatever function existent would require some type of script enabled.


try to use the noscript with with message or redirection when script disable

more on this.
Never miss a deadline with

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

scm0smlAuthor Commented:
is there way of automatically redirecting within <noscript>?

I don't want the user to be aware of what is going on so if javascript is disabled then they automatically get redirected to another page......?
this line will redirect to your page how enable the script within 2 second

  <meta http-equiv="refresh" content="2; URL=RedirectPageHere.html">

scm0smlAuthor Commented:
mmmm the re-direct works fine.

I was hopinh to redirect to the same page but passing in a param js=off.

The problem is it gets stuck in an infinite loop.....
you can not redirect to the same page since <noscript> will be in the head section and the browser will execute first

 what you can do is setting up a landing page such as env.html from this page depend on the javascript enable or not you will redirect them to the right page or add the right parameter to pass onto redirect page

 let's say you have default.html as of right now
 so from default.html
 <noscript> redirect to home.html?js=off</script>
         redirect home.html?js=on


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.