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.

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

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.