Flash Detection

This is a slimmed down combination of the Moock FPI & Apple Plugin Detection scripts to detect the Flash version installed on a users browser. This script is not a total package like the moock fpi, it's just a single function that will return the users flash version. To use, include the .js file from the download section and call the function getFlashVersion()

Usage
<script type="text/javascript" language="JavaScript" src="MLAB_flash_detection.js"></script>
<script type="text/javascript" language="JavaScript">
  flashInst = getFlashVersion();
  if(flashInst){
    document.write('Flash '+flashInst+' installed');
  }else{
    document.write('Flash not installed');
  }
</script>

This function will only return the major flash version installed on the users browser, for minor version detection you will have to call the getVersion() method built into flash. The script is also only configured to detect flash 3 and above. Theoretically, this should work all the way up until Flash 9.

If flash is not installed, the function returns 0.


Below are common implementations.


Redirection:

<head>
<script type="text/javascript" language="JavaScript" src="MLAB_flash_detection.js"></script>
<script type="text/javascript" language="JavaScript">
  flashInst = getFlashVersion();
  if(flashInst >= 6){
    window.location.replace('flashpage.html');
  }else if(flashInst > 0){
    window.location.replace('upgradepage.html');
  }else{
    window.location.replace('installpage.html');
  }
</script>
</head>
        

Swap content:

<head>
<script type="text/javascript" language="JavaScript" src="MLAB_flash_detection.js"></script>
</head>

<body>
<script type="text/javascript" language="JavaScript">
  flashInst = getFlashVersion();
  if(flashInst >= 6){
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="780" height="420">');
    document.write('<param name="movie" value="movie.swf" />');
    document.write('<param name="quality" value="high" />');
    document.write('<embed src="movie.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="780" height="420"></embed>');
    document.write('</object>');
  }else if(flashInst > 0){
    document.write('Time to upgrade');
  }else{
    document.write('Install flash now and be happy');
  }
</script>
<noscript>Unable to detect plugins</noscript>
</body>

Download

JS Include: MLAB_flash_detection.zip

Size: 1 kb

Last Updated: 2003-07-20