javascript availibility

R

reneeccwest

Hello,

I would like to check a user turn on or off the javascript option in
their web brower.

RWC
 
S

Steven Dilley

reneeccwest said:
Hello,

I would like to check a user turn on or off the javascript option in
their web brower.

RWC

<div id="noScripts"> Scripting is disabled </div>
<script type="text/javascript">
document.getElementById("noScripts").style.display="none";
</script>
<noscript>In fact, your browser is so old it does not even know what a
script is!</noscript>

Obviously, there is nothing you can do with this info:
you can't run a script to detect that scripts are disabled.
That is, you can not have "if (scriptsDisabled) {...}"

--Steve
 
G

Grant Wagner

Steven said:
<div id="noScripts"> Scripting is disabled </div>
<script type="text/javascript">
document.getElementById("noScripts").style.display="none";
</script>

The code above would tell me that IE 4 & 5, Netscape 4.x and Opera 6.x all
have scripting disabled when that may not be true.
<noscript>In fact, your browser is so old it does not even know what a
script is!</noscript>

Obviously, there is nothing you can do with this info:
you can't run a script to detect that scripts are disabled.
That is, you can not have "if (scriptsDisabled) {...}"

Something like the following is usually recommended:

<head>
<script type="text/javascript">
window.location.href = 'jsEnabledPage.html';
// or window.location.replace('jsEnabledPage.html');
</script>
</head>
<body>
Scripting is disabled
</body>

--
| Grant Wagner <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-developer/upgrade_2.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,573
Members
47,205
Latest member
ElwoodDurh

Latest Threads

Top