Detecting Shockwave with JavaScript

Date:    Thu, 2 Jan 1997 00:17:12 -0800
From:    Darrel Plant 
Subject: Re: Detecting Shockwave?

>Ok, Who knows the secret to detecting if a client has shockwave, going to
>the correct page, and wants to share?
This page checks for the Shockwave plugin in MSIE and Navigator (where possible). I use it on the page at http://www.moshplant.com/

<HTML>
<HEAD>
<script language="JavaScript">
<!--
function CheckBrowser() {
  for (var prop in navigator) {
      if (prop == "plugins") return true
      }
  return false
}

function CheckPlugins(PluginName) {
  for (i=0;i<navigator.plugins.length;i++) {
      if (navigator.plugins[i].name == PluginName) {
         return true
      }
  }
  return false
}
// -->
</script>
  <T ITLE>Page title here</T ITLE>
</HEAD>

<BODY>

<script language="JavaScript">
<!--
if (navigator.appName == "Microsoft Internet Explorer") {
  document.write("<OBJECT CLASSID='clsid:166B1BCA-3F9C-11CF-8075-444553540000'")

document.write("CODEBASE='//active.macromedia.com/director/sw.cab#version5,0
,1,53'")
  document.write("WIDTH='XXX' HEIGHT='YYY' NAME='Shockwave' ID='swmovie1'> ")
  document.write("<PARAM NAME='SRC' VALUE='yourmovie.dcr'> ")
  document.write("<PARAM NAME='BGCOLOR' VALUE='black'> ")
  document.write("</OBJECT><BR> ")
  }
if (CheckBrowser()) {
  if (CheckPlugins("Shockwave for Director"))
    document.write("<embed src='yourmovie.dcr' width=XXX height=YYY><BR>")
  else {
    document.write("alternateHTMLversionofpage")
    }
}

//-->
</script>

<noscript>
HTML for non-scriptable browsers goes here
</noscript>

</BODY>
</HTML>

URL: