find out if JS is activated or not

Started by Spaceman-Spiff, October 06, 2003, 12:20:43 PM

Previous topic - Next topic

Spaceman-Spiff

is there a way to find out if javascript is activated/available or not in a browser using http headers or php?

the 'Additional Options...' in SMF looks neat, but what if some people disabled JS, then he/she can't use the attachment feature at all...

Chris Cromer

<script type="text/javascript">
<!--
document.write("Hello World!")
//-->
</script>
<noscript>Your browser either does not support javascript or it's disabled!</noscript>
Chris Cromer

"I was here, here I was, was I here, sure I was" - The little voice in my head.

Spaceman-Spiff

hmm... should also we put the stuff inside additional options in post page inside <noscript> then?

Chris Cromer

Yeah, whatever is in the <noscript> tag gets displayed if the browser doesn't have javascript support, or it's disabled. So the additional options should appear if it isn't enabled.
Chris Cromer

"I was here, here I was, was I here, sure I was" - The little voice in my head.

Spaceman-Spiff

another way to do it:  make it visible by default and collapse it using js on load

Seph|roth

a little morw advanced detection:


<script language="javascript">
<!---// Determine the version number of jscript.dll.
    var version;
        if (typeof(ScriptEngineMajorVersion) + "" == "undefined")
        version = 1;
    else
        version = ScriptEngineMajorVersion();
document.write("Script engine version is"+" " +version+".x"+"<BR>")
document.write("I know javascript1.0")
//--></script> <br>
        <script language="javascript1.1">
<!---//by giving the version of javascript - you can detect which version is supported.
document.write("I know javascript1.1")
//--></script> <br>
        <script language="javascript1.2">
<!---
document.write("I know javascript1.2")
//--></script> <br>
        <script language="javascript1.3">
<!---
document.write("I know javascript1.3")
//--></script> <br>
        <script language="javascript1.4">
<!---
document.write("I know javascript1.4")
//--></script> <br>
<script language="javascript2.0">
<!---
document.write("I know javascript2.0")
//--></script>

Advertisement: