W3C home > Mailing lists > Public > w3c-wai-ig@w3.org > January to March 2001

RE: Any examples of <NOSCRIPT>?

From: Jon Hanna <jon@spinsol.com>
Date: Wed, 21 Feb 2001 10:37:51 -0000
To: <w3c-wai-ig@w3.org>
Message-ID: <NDBBLCBLIMDOPKMOPHLHKECBCPAA.jon@spinsol.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> Does anyone know of a real life effective use of the NOSCRIPT
> element?

Something I've done before but can't find any examples of is as
follows (most of the code is commented pseudo-code in a place where
you can't really have a comment, but you should get what I mean).

<script type="text/javascript">
 <!--
  if (document.all){//IE4+ object model available
   document.write('/*HTML code for dynamic menu using IE4 object
model*/')
  }
  elseif (document.layers){//NS4+ object model available
   document.write('/*HTML code for dynamic menu using NS4 object
model*/')
  else{//script is available, but neither of the object models used
for the menus
   document.write('/*HTML code for non-dynamic menu*/')
  }
  //-->
</script>
<noscript>
	<!-- HTML code for non-dynamic menu -->
</noscript>

Now there are still some possible issues with this (i.e. those issues
with screen readers based around browsers that can interpret dynamic
menus, but not necessarily well) lets for the sake of argument assume
my dynamic code is perfect in this regard - though I admit I doubt it
was - and you have <noscript> giving you a real alternative.

If I find a full example from real life in the next few days (I know
I've written at least one somewhere) I'll let you know.

One comment:

In much of my uses of javascript I have been able to provide an
alternative not with noscript, but with how I use the event handlers.
Commonly you have a link that activates a script when clicked, it is
often easy to make this degrade as such:

<a href="noscriptalternativeofjavascript.html"
onclick="activateFuntion();return false;">

in which case the return false stops the href of the link being
activated if script is available, but not if it isn't. Similarly:

<a href="alternative.html" onclick="return(activateFunction())">

In this case activateFunction returns true if it can't fulfil it's
function (say an object it needs is unavailable on the browser),
causing the link to go to the alternative html page. It returns false
if it fulfils its function. Browsers without script will go to the
page.

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.1 Int. for non-commercial use
<http://www.pgpinternational.com>

iQA/AwUBOpOad9lYbmO7kSNQEQISfgCg6IxME4JkJX1t5dIuYjKYPbaTybwAoJqe
dY95E+ydiaB0K9e0P6HgqgHX
=C7zr
-----END PGP SIGNATURE-----
Received on Wednesday, 21 February 2001 05:37:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 19 July 2011 18:13:53 GMT