Na navigaci | Klávesové zkratky

How to avoid activation of Active-X in IE

Updated December 11, 2007: I’m happy to say that Microsoft has now licensed the technologies from Eolas Technologies and removing the “click to activate” requirement in Internet Explorer. Read Knowledge Base 945007.

Recently, I wrote that soon it will be necessary to click on every Flash application in Internet Explorer in order to activate it. It looks like this:

Activation of Flash by mouse-click

Activation of Flash by mouse-click.

You can prevent this by inserting every active element (e.g. Flash) by external script. This brings two problems:

  • we have to laboriously rewrite all pages using Flash
  • JavaScript has to be enabled, otherwise Flash won't be displayed

Simple trick

You can prevent both difficulites using a simple trick. We will create a script, which will re-insert already existing active elements. File fix_eolas.js (download):

var objects = document.getElementsByTagName("object");

for (var i=0; i<objects.length; i++)
	objects[i].outerHTML = objects[i].outerHTML;

Property outerHTML is a proprietary feature of Internet Explorer, which doesn't make any difference, because only IE is affected by the “activating”. However, we must ensure that other browsers won't execute this script. For this we can use conditional comments.

Next thing we must ensure is, that re-inserting will be executed only after the HTML document is loaded and DOM rendered. It's possible to call the script on window.onload event, but it will only occur after loading of all parts of the page (images, etc.). It's more preferable to use attribute defer which instructs IE to execute the external script right after the rendering of DOM.

<!--[if IE]>
<script type="text/javascript"

And just a little demonstration.

That's all. Letter of the law is being fulfilled and Flash runs without activation ?

remark: Solution doesn't work with Flash Satay, described once at A List Apart. This method has otherwise a whole bunch of negatives, therefore I tried to find a better and valid solution.

Kindly translated by creamd

You might be interested in


  1. Gordan #1

    Doesn't work when using flashvars. Flashvars are empty in object[i].outerHTML

    17 years ago
  2. Liviu #2


    put the

    <!--[if IE]>
    <script type="text/javascript" src="fix_eolas.js" defer="defer"></script>

    Like this:
    <!--[if IE]>
    <script type="text/javascript" src="/js/fix_eolas.js" defer="defer"></script>
    code at the end of the body, in this way you will avoid the endless loading of the page.

    16 years ago

This article has been closed. It is no longer possible to add comments.

phpFashion © 2004, 2024 David Grudl | o blogu

Ukázky zdrojových kódů smíte používat s uvedením autora a URL tohoto webu bez dalších omezení.