Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

programmatically detecting javascript enabled

Posted on 2010-11-08
7
Medium Priority
?
389 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
Industry Leaders: 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

636 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