QuickTime Developer Series


Sample Chapter

Detecting the QuickTime Plug-in

Experiencing your website depends on the QuickTime Plug-in, so you want to be sure your visitors have it. If they don't, you want to redirect them to a download page or to alternate content pages.

Detecting browser plug-ins tends to be a black art, due to inconsistencies among browsers, operating systems, ActiveX, JavaScript, and VBScript. The easy and reliable way is to use QuickTime to detect itself.

You can do this by embedding a QuickTime movie in your main page that automatically redirects people with QuickTime to the desired content page. Add a refresh tag to your Web page to automatically redirect people without QuickTime--either to a download page or an alternate content page.

Here's a small HTML page (in the SpecialDelivery folder of the CD as Redirect.htm ) that detects whether the viewer has QuickTime 4 or later and redirects the browser accordingly. It works with Internet Explorer or Netscape browsers, versions 3 and later, on Mac OS or Windows (95/98/NT/2000).

<HTML>
<HEAD>
<TITLE>Detect QuickTime</TITLE>
<META HTTP-EQUIV="Refresh" CONTENT="8;URL=GetQT4.htm">
</HEAD>

<BODY>
<DIV ALIGN="Center">

<EMBED SRC="GetQT4.qti" TYPE="image/x-quicktime"
HEIGHT="120" WIDTH="160"
ALT="You need QuickTime: www.apple.com/quicktime/download"
QTSRC="Letsgo.mov" HREF="HasQT.htm"
CONTROLLER="False" AUTOPLAY="True"
QTNEXT1="HasQT.htm"
PLUGINSPAGE="http://www.apple.com/quicktime/">

<P>
If you have QuickTime 4 or later, you should automatically be taken to our<A HREF="HasQT.htm>main page</A> in 1-2 seconds.
</P>
<P>
If you need to install or configure QuickTime, you should automatically be redirected to our
<A HREF="GetQT4.htm">download page</A> within 10 seconds...
</P>
</DIV>
</BODY>
</HTML>

What it Does

If viewers have QuickTime 4 or later, this page displays Letsgo.mov for half a second, then loads HasQT.htm in the current browser window.

If viewers don't have QuickTime, the browser should alert them and offer to take them to www.apple.com/quicktime/download/ .

If viewers have an old version of QuickTime, they should see UNeedQT4.qti for a few seconds, then be automatically redirected to the GetQT4.htm Web page.

If viewers get impatient waiting for the redirect, those with QuickTime 4 or later can click the Letsgo.mov movie and jump to the main content page; those who need to get QuickTime can click the text link to the GetQT4.htm page.

How it Works

If viewers have QuickTime 4 or later, the QuickTime Plug-in will correctly interpret the parameters
QTSRC="Letsgo.mov"
CONTROLLER="False" AUTOPLAY="True"
QTNEXT1="HasQT.htm"
to load Letsgo.mov , play it automatically without a controller, then load HasQT.htm in the default browser window.

Letsgo.mov is a one-frame movie only 1 kilobyte in size and a half-second in duration, so this should happen in the blink of an eye. If not, viewers can click the Letsgo.mov movie; the QuickTime Plug-in will interpret the
HREF="HasQT.htm"
parameter and load HasQT.htm in the default browser window immediately.

If viewers don't have QuickTime, the PLUGINSPAGE parameter should cause the browser to bring up an alert window offering to take them to
www.apple.com/quicktime/download/ .

If viewers have an older version of QuickTime, all the <EMBED> parameters will be ignored except SRC , HEIGHT , and WIDTH, so the plug-in should display GetQT4.qti instead of Letsgo.mov .

GetQT4.qti is an image that directs viewers to the QuickTime download site.

The <META HTTP-EQUIV="Refresh" CONTENT="8;URL=GetQT4.htm"> tag in the page header should automatically redirect viewers to the GetQT4.htm Web page after 8 seconds, whether they can see UNeedQT4.qti or not. This also acts as a fallback in case the browser ignores the PLUGINSPAGE parameter.

The 8-second delay before the refresh makes sure that viewers who do have QuickTime 4 have ample time for Letsgo.mov to load and play, even if there's congestion on the network.

The manual link at the bottom of the page gives impatient viewers a quick way to the download page if they don't have QuickTime, and it acts as a fallback in case the browser fails to execute the automatic refresh.

Despite being only 25 lines of HTML, this page provides belt-and-suspenders redundancy. I have yet to see it fail under any circumstances.

GetQT4.qti and Letsgo.mov can both be found in the SpecialDelivery folder of the CD. You're welcome to use them on your own website or CD.

Variations

The example page redirects viewers who have QuickTime 4 to a page named HasQT.htm . You should edit both instances of HasQT.htm to point to your main content page.

The example page redirects viewers who need QuickTime 4 to a page named GetQT4.htm . This is a short Web page which explains that the viewer needs QuickTime 4 or later to experience your website, explains that it's a free download, and includes a link to the Apple download site. It also has help for people who already have QuickTime 4 but were redirected because of a browser problem. GetQT4.htm is also in the SpecialDelivery folder of the CD. You're welcome to use it as-is or edit it to look better in your website.

Alternately, you can edit the example to point to your own version of a download page, or to an alternate version of your main page that doesn't use QuickTime content, or directly to Apple's QuickTime download page.

If you're redirecting viewers without QuickTime to a non-QuickTime page, delete the PLUGINSPAGE parameter from the <EMBED> tag.

It's also possible to use a combination of JavaScript and VBScript to detect QuickTime, but it's somewhat dependent on the user's browser, operating system, and QuickTime version. For details, see "Useful JavaScripts" (page 139).


< PREVIOUS PAGE

Home | Updates | Corrections | FAQ | Table of Contents |