DHTML
JavaScript - An Introduction
Accessibility
One important thing to take into consideration when using extensive JavaScript on the Web is: Will everyone be able to properly see and use it? Just as accessibility is very important when creating Web pages, it is equally important when writing JavaScript.
Even though the vast majority of people are using newer browsers that support JavaScript (and these have been around since 1996), some people are using text only browsers (such as visually impaired people), while others are using alternative devices like older (non-smartphone) cell phones to access Web pages. Yet another percentage of people for one reason or another have disabled JavaScript, perhaps because they think it is a security risk, or perhaps because they are using a "pop-up killer" that disables certain JavaScript functions such as opening new windows.
You should ask yourself if your page will be at least somewhat functional
without JavaScript. You
should never have a page that relies solely on JavaScript for navigation,
or for showing information that you want people to see. There are several
ways to redirect users so they will always see the right page that we will
discuss later on, but for now, there is a really easy way to show content
that non-JavaScript browsers can see: The <noscript> tag.
Using the <noscript> tag
The <noscript></noscript> HTML tags are a really easy way to provide alternate content for non JavaScript enabled browsers. Anything you put inside these tags will not be seen by browsers with JavaScript. Browsers that have JavaScript disabled however, will see all the content of these tags. You could even go as far as having an entire page of information contained in these tags. At the very least though, you should tell your users that your site relies on JavaScript, and that they should turn it on, or upgrade their browser. You could also place a link in the <noscript> tags for an alternate, non-JavaScript version of your site.
You don't need an older non-JavaScript browser to see what is in your <noscript> tags, you can just temporarily disable JavaScript to see how your page will look.
Disabling JavaScript in Internet Explorer
In IE 5 and up, go to Tools > Internet Options, then select the Security tab. If you are testing a site on your local computer, make sure you click the Local Intranet icon, then click Custom Level. (If you are testing an online site, click the Internet icon.) Scroll down to the Scripting section, then under Active scripting, check Disable. Click enable to turn JavaScript back on when you are done.
Disabling JavaScript in Firefox
Choose Tools > Options. Click Content. Uncheck Enable JavaScript. Check this option again to turn JavaScript back on. A Firefox add-on such as the Web Developer Toolbar can speed this up by giving you an option right on the toolbar to disable JavaScript.
Accessibility Summary
- Always keep in mind that not everyone will be able to run your JavaScript in their browser.
- HTML between the <noscript></noscript> tags will only show up if the browser can't run JavaScript.
- It is a good idea to provide alternate content, or some other message inside the <noscript></noscript> tags.
- You can disable JavaScript so that you can see how your <noscript> content will look.
Coming Soon:
- Feb 13
- ISSD 24 - XML
- Feb 21
- ISSD 23 - Web 2.0 Technology
- Feb 23
-
Facebook for Business
Hours: 2
Cost: Free!
- Feb 25
-
Search Engine Optimization (SEO)
Hours: 2
Cost: Free!
- Feb 25
-
Search Engine Marketing (SEM)
Hours: 2
Cost: Free!
- Mar 05
- ISSD 23 - Ajax
DHTML - TOC - Introduction - Books -
JavaScript - An Introduction - Links - Questions -
1 - 2 - 3 - 4 - [ 5 ] -
