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.
mburrows050897Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mburrows050897Author Commented:
Edited text of question.
0
Michel PlungjanIT ExpertCommented:
Try this:
<html>
<head>
<title>QT Plugin Script</title>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript"><!-- // cloak
/* CrossBrowser mime support detection
   (c) Michel Plungjan jav@scripting.demon.nl */

IE = (document.all) ? 1 : 0;
NS = (navigator.appName=='Netscape' && document.images) ? 1 : 0;

if (IE)
   document.write('<IMG NAME="testimage" SRC="x.qt" HEIGHT=1 WIDTH=1 ALT="">');
// plugin information
theSuffix = 'qt';
thePlayer = 'apple'
pluginOK = false;
thePlugin = '';
if (IE) thePlugin = testimage.mimeType;
if (thePlugin.toLowerCase().indexOf(thePlayer) !=-1) {
   pluginOK = true;
}
if (NS) {
   for (var i=0;i<navigator.mimeTypes.length;i++) {
      if (navigator.mimeTypes[i].suffixes.indexOf(theSuffix) != -1) {
         if (navigator.mimeTypes[i].enabledPlugin) {
            pluginOK = true;
            thePlugin = navigator.mimeTypes[i].enabledPlugin.name;
         }
         break;
      }
   }
}

// if plugin is detected, embed a quicktime film
if (pluginOK) {
   document.write('<EMBED SRC="myfilm.qt">');
}
else document.write('<IMG SRC="myfilm.gif">');
// uncloak --></SCRIPT>
</body>
</html>

Michel
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Michel PlungjanIT ExpertCommented:
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
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Michel PlungjanIT ExpertCommented:
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
0
morphyCommented:
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!
0
Michel PlungjanIT ExpertCommented:
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>


 
0
Michel PlungjanIT ExpertCommented:
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');
   }

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Components

From novice to tech pro — start learning today.