QuickTime for the Web: For Windows and Macintosh, Second Edition

Sometimes you need to modify your HTML to work around differences in browsers and operating systems. And sometimes you need to do something that HTML just doesn't do. A little JavaScript can help.
You can use JavaScript to determine which browser and operating system a visitor has. The same script can then write out the proper HTML for that visitor. For example, you might use the tag for Internet Explorer on the Windows OS and the tag for any other browser or OS. JavaScript can also do some things that HTML can't, such as opening a new window with a specific size and attributes. In some circumstances, you can use JavaScript to detect whether QuickTime is installed.
This chapter introduces you to some JavaScript basics, then provides three sample scripts that you can use:
script to detect a user's operating system, browser type, and browser version
a script that opens a special player window for QuickTime
a script that attempts to detect whether QuickTime is present
You can also use JavaScript to control QuickTime, to do things like play a movie when the mouse passes over an object. We'll look at using JavaScript to control QuickTime in "QuickTime and JavaScript" (page 471).
You can use the included scripts in your Web pages without needing to know much about JavaScript; if you're new to JavaScript, the following information should provide the necessary orientation.
A complete JavaScript tutorial is outside the scope of this book; to learn...