Solved

programmatically detecting javascript enabled

Posted on 2010-11-08
7
385 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 150 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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 350 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

728 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