![]() |
|
|
Advanced Web Design | ||
| Web Design Program | |||||
|
|
Scripting Database |
|
|||
|
Identifying Javascript Compatability |
|||||||||||||||||||||||||||||||||||
|
Though it might seem inconceivable that there are still people out there
using browsers that are not JS enabled, it is nevertheless true. Maybe
he is using a pre-historic browser; maybe he turned off JavaScript afraid
that someone will format his hard disk using a JavaScript program (this
condition is usually referred to as paranoia by medics); or maybe they
are just plain tired of the things people like you and me do to his browser
using JavaScript (I have to admit this seems a bit far fetched. I mean,
who could ever get tired of flashing background, scrolling status bar
and helpful messages popping up every now and then). The above code will pop up a dialog box in a JS browser but will have
no effect in a non-JS browser. Note that proper commenting is still required between the <SCRIPT>
tags because non JavaScript browsers don't recognize the <SCRIPT> tag
either and will display the code within them if it is not commented.
Don't forget to enclose the script within HTML comments as shown. Now, when ever this page is loaded in a JS enabled browser, it will automatically go to the JS enabled page. The only problem with this page is that it's contents are displayed in the browser before loading the JS enabled page. Step 2 solves that problem.
All links to should point to the non-JS version of the page. If the browser doesn't support JavaScript, the contents of the page are displayed. If the browser supports JavaScript, the JS version of the page is automatically loaded in the browser.
|
||||||||||||||||||||||||||||||||||||