Flash Detection JavaScript

Websites that use flash must use flash detection JavaScript. Such a JavaScript will look for flash player on the user’s browser. If it detects no flash player, it will display an alternative image instead of the flash. This makes your web page user-friendly for all those visitors who do not have flash player installed. For me, it’s a must for all web pages that use flash. For reference you might want to look at how I used flash detectionJavaScript on the home page for DagadTrikon.com. The only drawback is that it wouldn’t work when JavaScript is disabled.

Here are the JavaScript files you will need. I didn’t write these scripts but got it while I was working at ECommerce Partners. Hence, I have no clue who to credit for this.
Flash Detection JavaSript File 1

Flash Detection JavaSript File 2

Flash Detection JavaSript File 3

All you need to do is include the above files, and then add the following code in the HTML:

<script language=”javaScript” type=”text/javascript”>

//<![CDATA[

if (!useRedirect) { // if dynamic embedding is turned on

if(hasRightVersion) { // if we've detected an acceptable version

var oeTags = '<object>Flash Here</object>';

document.write(oeTags); // embed the flash movie

} else { // flash is too old or we can't detect the plugin

var alternateContent = '<img />';

document.write(alternateContent); // insert non-flash content

}

}

//]]>

</script>

<noscript><img /></noscript>

Related posts:

  1. Validating HTML/XHTML Validating HTML/XHTML implies checking HTML/XHTML file for conformance to W3C...
  2. Check Web Page Download Time One of the principles of usability is fast downloading of...
  3. How to add specific style/script for IE in HTML? There are times when we want a specific style or...

Tags: , ,

Leave a Reply