Return to Snippet

Revision: 22312
at January 8, 2010 16:55 by kossmoss


Initial Code
<script language="javascript">
var plugin;
var version = 5;
var flash = false;
if (navigator.plugins)
{
    if (navigator.plugins["Shockwave Flash"])
  {
        plugin = navigator.plugins["Shockwave Flash"].description;
        flash = parseInt(plugin.charAt(plugin.indexOf('.') - 1)) >= version;
    } else {
        if ((navigator.userAgent.indexOf('MSIE') != -1)
            && (navigator.userAgent.indexOf('Win') != -1))
    {
            var vb = '<script language="vbscript">\n'
                  + ' on error resume next\n'
                  + ' flash = IsObject(CreateObject(\n'
                  + ' "ShockwaveFlash.ShockwaveFlash.' + version + '"))\n'
                  + '<' + '/script>';
            document.write(vb);
        }
    }
}
if ( flash ) {
  // write flash code
  document.write('<object>...</object>');
} else {
  // alternative image code
  document.write('<img src=""/>');
}
</script>

Initial URL

                                

Initial Description
Also we can use HTTP_ACCEPT

Initial Title
Alternative image output if user have Flash turned off

Initial Tags
flash

Initial Language
JavaScript