?
Solved

programmatically detecting javascript enabled

Posted on 2010-11-08
7
Medium Priority
?
386 Views
Last Modified: 2012-05-10
Hi,

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?
0
Comment
Question by:scm0sml
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 13

Assisted Solution

by:F Igor
F Igor earned 600 total points
ID: 34085699
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.

0
 
LVL 7

Expert Comment

by:dxdinh
ID: 34086233


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

more on this.

http://www.plus2net.com/javascript_tutorial/javascript_support.php
0
 

Author Comment

by:scm0sml
ID: 34092175
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......?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:dxdinh
ID: 34097565
this line will redirect to your page how enable the script within 2 second

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

-------------------------
http://www.plus2net.com/javascript_tutorial/javascript_support.php
0
 
LVL 7

Accepted Solution

by:
dxdinh earned 1400 total points
ID: 34097584
or to simplify the code within 1 second redirect

<noscript>

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

</noscript>

0
 

Author Comment

by:scm0sml
ID: 34100079
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.....
0
 
LVL 7

Expert Comment

by:dxdinh
ID: 34103832
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>
  <script>
     yes
         redirect home.html?js=on

</script>
       
 

 
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question