Groups > Asp .Net > Getting started with ASP.NET > Re: how to detect if JavaScript is enabled or not




Re: how to detect if JavaScript is enabled or not

Re: how to detect if JavaScript is enabled or not
Thu, 3 Apr 2008 17:26:31 +0000
Suprotim Agarwal:

Hi,

Check it using the following code:

if (Page.Request.Browser.EcmaScriptVersion.Major >= 1)

{

// your code

}

else

{

// Response.Write('Javasctipt disabled');

}


HTH,
Suprotim Agarwal



This tells one...

"The version number of ECMAScript that the browser supports"

...per MSDN-- so that is just SUPPORTS JAVASCRIPT true/false.

However, I need to know if it is ENABLED.
Post Reply
how to detect if JavaScript is enabled or not
Thu, 3 Apr 2008 18:56:29 +0000
All --

Please help.

I need to know how to detect if JavaScript is enabled or not.

Is there a good, reliable, simple, programmatic, way to do this from the
code-behind?

Is there a good, reliable, simple, way to do this from the code-infront?

Please advise.

Thank you.

-- Mark Kamoski
Post Reply
Re: how to detect if JavaScript is enabled or not
Thu, 3 Apr 2008 19:03:09 +0000
Request.Browser.JavaScript in code behind...if true then it supports
Javascript
Post Reply
Re: how to detect if JavaScript is enabled or not
Thu, 3 Apr 2008 19:04:57 +0000
hi!

the good new is that you can use the <noscript /> tag
http://www.w3.org/TR/html401/interact/scripts.html

 

In the following example, a user agent that executes the SCRIPT will include
some dynamically created data in the document. If the user agent doesn't support
scripts, the user may still retrieve the data through a link.

<SCRIPT type="text/tcl">
 ...some Tcl script to insert data...
</SCRIPT>
<NOSCRIPT>
 <P>Access the <A
href="http://someplace.com/data">data.</A>
</NOSCRIPT>


the bad news is that is not xhtml strict compliant...

 

ciao ;-)
Post Reply
Re: how to detect if JavaScript is enabled or not
Thu, 3 Apr 2008 19:10:04 +0000
<script>
function Check() {

    if (navigator.JavaEnabled()) {
        alert("The javascript is available .")
    }
    else {
        return false
    }

}
</script>
Post Reply
<< Previous 1 2 3 4 Next >>
( Page 1 of 4 )
about | contact