• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 207
  • Last Modified:

Determining if Flash Player is on the client

I need a way that works in both IE and Netscape at least version 4 of each.  If it works in previous version all the better.  What it needs to do is determine if the client can view a flash movie if not it needs to direct them to a different page.
1 Solution
Write object HTML code like this:

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 ID=index WIDTH=100% HEIGHT=100%>
 <PARAM NAME=movie VALUE="index.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#000000> <SCRIPT LANGUAGE=JavaScript>
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin && parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) >= 4 ) {
      // Check for Flash version 4 or greater in Netscape
      document.write('<EMBED src="index.swf" quality=high bgcolor=#000000 ');
      document.write(' swLiveConnect=FALSE WIDTH=100% HEIGHT=100%');
      document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
} else if (!(navigator.appName && navigator.appName.indexOf("Netscape")>=0 && navigator.appVersion.indexOf("2.")>=0)){
      // Netscape 2 will display the IMG tag below so don't write an extra one
      document.write('<IMG SRC="index.gif" WIDTH=710 HEIGHT=564 BORDER=0>');
<NOEMBED><IMG SRC="index.gif" WIDTH=710 HEIGHT=564 usemap="#index" BORDER=0></NOEMBED>
<NOSCRIPT><IMG SRC="index.gif" WIDTH=710 HEIGHT=564 usemap="#index" BORDER=0></NOSCRIPT>

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now