Tim Igoe's Web Design, Development and Hosting Blog

Javascript – Bypass Click to Activate Flash in IE

Posted on by Tim Igoe

If you’ve found the Click to Activate ‘feature’ that has been added to Internet Explorer annoying, first question is why are you using Internet Explorer? Firefox ( www.getfirefox.com ) is a safer browser. Avoiding the IE vs Firefox flame war however, too many users use IE therefore we all have to cater for that browser.

Quite a few sites use flash based menus, more recently Microsoft have been forced to make changes to how ActiveX controls work, this means you have to click to activate the control, before clicking the option – double clicking links on the web, how annoying!

However, there is a way around this using a simple bit of Javascript.


function ShowFlash(flash, width, height)
{
document.writeln('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"width="' + width + '" height="' + height + '">');document.writeln('');document.writeln('');document.writeln('');document.writeln('pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"width="' + width + '" height="' + height + '" wmode="transparent">');document.writeln('');
}

That block of code is set up for Flash 8, change the version strings and classid for the alternate versions of flash.

To use this, you insert a small block into your HTML where you would normally place your flash code. Changing the path, width and height to be those of your flash file.


//

This entry was posted in Javascript and tagged . Bookmark the permalink.

Leave a Reply