Face it, JavaScript is cool. There is a ton you can do with JavaScript
within a Web page. You can set up interaction. You can produce automation. You
can tap into features of the browser being used. You can validate information.
The list of what you can do goes on and on and on. There are so many things you
can do that Web sites such as www.JavaScripts.com
are centered providing a repository of scripts that can do different things.
So you've created the ultimate cool page. You have a flashy title. You have
text following your cursor. You have menus that change colors and fonts. You
have pop-up help. You have an interactive calendar. You have the ultimate in Web
pages. Or, maybe you have a simple Web page that just uses a simple little
script to make sure the user provided a piece of information.
Then, the user that comes to your site has scripting turned off in their
browser....
Oops! Now your flashy site doesn't have a flashy title. Nor does it have text
following the cursor, or menus that flash, or that popup help, or a calendar
that works. The page also can't validate that information. Even the simple Web
page is suddenly rendered near useless.
Is it a bad user or a bad Web page? While the tendency is to say it is a bad
user, the reality is, you should have expected this possibility to happen.
Because of viruses and many other web contaminants, many people have chosen to
turn scripts off. It's safer.
Alternatives for the Anti-Scripters
What can you do to make sure that your pages are not rendered totally useless
for these anti-scripters?
You can include <noscript> tags on your page. The <noscript> tag
can be used to include standard HTML and other standard text that will be
displayed when the browser won't evaluate scripts. In fact, the <noscript>
tag will execute when one of two conditions is present:
1. The browser viewing the page isn't
set to run script
2. The browser or program being used to
view the page does not support the scripting language being used.
If one of these two cases is true, then the information within a <noscript>
tag block will be executed.
Using the <noscript> Tag
The <noscript> is used like other HTML tags. You begin the tag block
with <noscript>. You end it with </noscript>. Anything in between
will be displayed when one of the two conditions above are true. If you create a
page with a critical piece of JavaScript, you might want to include a <noscript>
tag for that person that has scripting turned off.