This is where I write about website development, search engine optimization and my thoughts on various issues. If you are interested in a particular topic, then check the section under categories on the right. I hope you will find something here that might interest you. So, sit back and read along.

Flash Detection JavaScript

May 9th, 2006

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 Articles:

Leave a Reply