spacer
Yehuda Shiran May 10, 2001
Checking the Plug-in Installation
Tips: May 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

In some of your applications you may need to use Flash Audio and JavaScript directly, without any prepackaged APIs such as the FlashSound JavaScript API. You will enjoy more features, methods, and properties, but you'll have to take care of all the tiny details that are taken for granted when using the FlashSound API.

One of these tiny details is checking that the Flash plug-in is installed in Mac or Windows Navigator. The following function, Flash_checkForPlugIn(), does exactly that. It checks that the mimeTypes object exists, that one of the mime types is flash, and that its relevant plug-in is enabled. The function also extracts the plug-in version, and checks that it is higher than the default minimum player version. The default minimum player version is set as a global variable before calling Flash_checkForPlugIn(). Here is the function in full, remember that it must be preceded by the global variable assignment of minPlayer:

function Flash_checkForPlugIn() {
  var plugin = (navigator.mimeTypes &&
  navigator.mimeTypes["application/x-shockwave-flash"]) ?
  navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
  if (plugin) {
    var pluginversion =    
  parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) 
  if(pluginversion >= minPlayer) {return true;}
  }
  return false;
}


People who read this tip also read these tips:

Look for similar tips by subject:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business