Quantcast

Fixing The “Click To Activate” Flash Content In IE

Get the WebProNews Newsletter:
[ Business]

In the good name of internet security, Microsoft added a feature in Internet Explorer that disables automatic activation of objects. All objects in an HTML <object> tag is affected and that includes Java applets and Adobe Flash content.

That means you manually have to click a Flash movie in order to activate it before you can use it.

If you have a Flash menu on your website, then the visitors have to click twice in order to navigate – one to activate and one to click the actual link. You don’t want that!

Lucky for us, JavaScript can solve the problem quite easily. Just add this script to the <head> section of your HTML document.

<script type="text/javascript">
function ActivateFlash()
{
    var objects = document.getElementsByTagName("object");
    for (var i = 0; i < objects.length; i++)
    {
      objects[i].outerHTML = objects[i].outerHTML;
    }
}
</script>

And call the function from the tag like this:

<body onload="ActivateFlash();">

Of course, this is not a good solution, because you probably already have an included JavaScript file and don't want scripts mixed with your HTML. The obvious choice is to add the script to your .js file, and then add an event handler, so you don't need to call it with an onload-command from the tag.

Copy the function into your .js file and add the event handler line in top of that file:

window.onload = ActivateFlash

function ActivateFlash()
{
    var objects = document.getElementsByTagName("object");
    for (var i = 0; i < objects.length; i++)
    {
      objects[i].outerHTML = objects[i].outerHTML;
    }
}

By doing it this way, you don't have to pollute you're HTML with JavaScript in order to eliminate the Flash activation in Internet Explorer.

Comments

Add to Del.icio.us | Digg | Reddit | Furl

Bookmark WebProNews:

Mads Kristensen currently works as a Senior Developer at Traceworks located
in Copenhagen, Denmark. Mads graduated from Copenhagen Technical Academy with a multimedia degree in
2003, but has been a professional developer since 2000. His main focus is on ASP.NET but is responsible for Winforms, Windows- and
web services in his daily work as well. A true .NET developer with great passion for the simple solution.

http://www.madskristensen.dk/

Fixing The “Click To Activate” Flash Content In IE
Comments Off
About Mads Kristensen
Mads Kristensen currently works as a Senior Developer at Traceworks located in Copenhagen, Denmark. Mads graduated from Copenhagen Technical Academy with a multimedia degree in 2003, but has been a professional developer since 2000. His main focus is on ASP.NET but is responsible for Winforms, Windows- and web services in his daily work as well. A true .NET developer with great passion for the simple solution.

http://www.madskristensen.dk/ WebProNews Writer
Top Rated White Papers and Resources

Comments are closed.

  • Join for Access to Our Exclusive Web Tools
  • Sidebar Top
  • Sidebar Middle
  • Sign Up For The Free Newsletter
  • Sidebar Bottom