“The purpose of JavaScript is to add an extra layer of usability to a Web page.”

“At the time of writing, the Ajax hype is still running at full speed. Nonetheless I believe that it will end just as DHTML did: people will simply lose interest and it will fall apart into a bit of JavaScript and a lot of hot air—though I don’t know when this will happen.” ;)

Screen readers

“Suffice it to say that you cannot assume anything about screen-reader event support.

The situation is in fact so bad that I fear accessibility is just not possible in the generation of screen readers current at the time of writing. It was Derek Featherstone who drew the harsh but correct conclusion, “We can deal with JavaScript on or off, but we can’t deal with in between,” and therefore he feels it’s better to ask users of older screen readers to disable JavaScript entirely. If they do, they’ll fall back to a noscript page, and that’s a situation we can handle.

At the moment, and speaking from the scant knowledge we have about screen-reader JavaScript support, I’m forced to agree with him, albeit reluctantly. Noscript screen readers are far easier to cater to than script-enabled screen readers.”

Hiding content

“Without JavaScript, though, the content will never become visible, and the page is inaccessible. If you create a page that hides information until the user activates a script, you should always give the “hide content” commands in JavaScript, not in CSS.”

Redirecting users

<head>
<title>Noscript page</title>
<script type="text/javascript">
var isSupported = [check JavaScript support];
if (isSupported)
    location.replace('scriptpage.html');
</script>
</head>

Never ever use location.href in such situations. Using location.href creates a new entry in the browser’s history (which we’ll discuss fully in 6C). If the user arrives at the noscript page, she is redirected to the scripted page. Once she presses the Back button, however, she’s sent back to the noscript page, where the script promptly fires up and sends her back to the scripted page. The Back button is effectively broken—one of the worst usability sins in existence.”

Object Detection

var W3CDOM = document.createElement && document.getElementsByTagName;