Link to home
Start Free TrialLog in
Avatar of mburrows050897
mburrows050897

asked on

Check for Quicktime Plugin in IE

Is there a way I can use Javascript to test for the Quicktime mimetype and / or plugin that will work on Internet Explorer?
If the browser can't play the Quicktime, my client would like to substitute an animated gif.
I don't think navigator.mimeTypes or navigator.plugins are recognized by Internet Explorer, but I could be wrong because I only have Internet Explorer 3 on PC and 4 on Mac to test with.
Thanks for any pointers you can provide.
Avatar of mburrows050897
mburrows050897

ASKER

Edited text of question.
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
And you are correct. IE3 does not support the mime or plugin array
and later versions of IE has the arrays but they are always empty.

Michel
Here is an untested addition:

change

if (IE)
document.write('<IMG NAME="testimage" SRC="x.qt" HEIGHT=1 WIDTH=1 ALT="">');

to

if (IE) {
   testImage = new Image();
   testImage.src = 'x.qt';
}

if it works (I have had no time to test), you won't get that little broken image...

Michel
hi!
have u succeded in solving the problem with IE?
because the proposed answer doesnt work with me!!!!
(i need to detect the shockwave flash plugin)
help me plz!
have a nice day!
BINGO!!!!!!!!!!!!!!


http://www.apple.com/quicktime/authoring/qtjavascript.html


 
 Using Javascript to Detect QuickTime

Using JavaScript to detect a plug-in is something of a black art. You need to take into account the user's operating system, browser type, and browser version you need to use JavaScript, VBScript, and ActiveX objects, and even then it won't always work. The easiest and most reliable way to detect QuickTime is to use QuickTime itself. Still, in some circumstances it is possible to detect a plug-in by using a combination of JavaScript and VBScript. HereÕs how it works:

 Netscape browsers (all versions, all operating systems) you can use the JavaScript plugins object.

 Internet Explorer (version 5 or later, Mac OS) you can use the JavaScript plugins object.

 Internet Explorer (Windows) you can use VBScript and ActiveX to detect QuickTime 4.1.1 or later

<script language="Javascript">
<!-- hide from pre-script browsers
     var haveqt = false;
//-->
</script>

<script language="VBScript">
<!-- hide from pre-script browsers
On Error Resume Next
Set theObject = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1")
On Error goto 0

If IsObject(theObject) Then
     If theObject.IsQuickTimeAvailable(0) Then 'Just check for file
          haveqt = true
     End If
End If
//-->
</script>

<script language="Javascript">
<!-- hide from pre-script browsers
     if (navigator.plugins) {
          for (i=0; i < navigator.plugins.length; i++ ) {
               if (navigator.plugins[i].name.indexOf("QuickTime") >= 0)
                    { haveqt = true; }
            }
        }
//-->
</script>
</head>

<body bgcolor="#ffffff">
<H1>Check for QuickTime</H1>

<script language="Javascript">
<!-- hide from pre-script browsers
    if (haveqt)
    {document.write('<embed src="hotfire.mov" width=120 height=51>');}
    else
    {document.write('You do not seem to have " +
    "<a href="http://www.apple.com/quicktime">QuickTime');}
//-->
</script>

<noscript>
Your browser doesn't support scripting, so you can't check forQuickTime.
</noscript>


 
Haha - they have a bug!

Please change
   if (haveqt)
                          {document.write('<embed src="hotfire.mov" width=120 height=51>');}
                          else
                          {document.write('You do not seem to have " +
                          "<a href="http://www.apple.com/quicktime">QuickTime');}

to

    if (haveqt) {
      document.write('You DO have quicktime: '+
      '<embed src="hotfire.mov" width=120 height=51>');
   }
   else {
      document.write('You do not seem to have ' +
       '<a href="http://www.apple.com/quicktime">QuickTime');
   }