Web Publishing Reference Guide
Setting Up Flash Detection
This page has implemented client-side flash detection using javascript.
To use the Flash detect code, you can download flash_detect.zip which contains the javascript code you need and a sample HTML page for your reference. You can also download just the javascript file, AC_OETags.js. You will need to do the following in your HTML page:
Insert in the <head> area the following JavaScript calls and code:
<script type="text/javascript" src="AC_OETags.js"></script>
<script language="JavaScript" type="text/javascript">
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor revision of Flash required
var requiredRevision = 0;
// -----------------------------------------------------------------------------
// -->
</script>
This defines the version requirements for the flash movie you are embedding.
Then in the body area where you want to insert the Flash movie, place the following code:
<script language="JavaScript" type="text/javascript">
<!--
// Version check based upon the values entered above in "Globals"
var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
// Check to see if the version meets the requirements for playback
if (hasReqestedVersion) {
// if we've detected an acceptable version
// embed the Flash Content SWF when all tests are passed
AC_FL_RunContent(
"src", "has_flash.swf",
"width", "45",
"height", "40",
"align", "middle",
"id", "globe",
"quality", "high",
"wmode", "transparent",
"name", "globe",
"movie","has_flash",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
document.write('<p>Flash player version ' + GetSwfVer() + ' was detected on your browser.</p>');
} else { // flash is too old or we can't detect the plugin
var alternateContent = '<a href="http://www.adobe.com/go/getflashplayer">';
alternateContent += '<img src="/sites/default/files/migration/no_flash.gif" alt="Download Flash 9" /></a>'
+ '<p>This content requires the Adobe Flash Player version ' + requiredMajorVersion + '.<br />'
+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a></p>';
document.write(alternateContent); // insert non-flash content
}
// -->
</script>
<noscript>
<a href="http://www.adobe.com/go/getflashplayer"><img src="/sites/default/files/migration/no_flash.gif" alt="Download Flash 9" />
<object width="32" height="32">
</object>
</a>
</noscript>
In this example, "has_flash.swf" is the path to the flash file and "has_flash" is that path without the .swf at the end.
You can also view source on this page to see it in context of an HTML page.
IS&T Service Desk
Monday-Friday
Telephone/Online: 8am - 6pm
Walk-In (N42) 9:15am - 5pm
Web: IS&T Service Desk
Email: computing-help@mit.edu
Phone: 617.253.1101

