Eolas Workaround Fails If Triggered From Deferred Script
As a workaround to the gruesome IE Eolas patch, you must write your SWFs into the DOM from an external JavaScript library or other external source. This can happen via a function call within the body of your document, or can be triggered by an onload event.
These two triggers have their downsides. It is often not desirable to put a JS function call within the body of your HTML document, as this makes your code more difficult to maintain. If you have a large site, you probably want a single library that you can snap in and out at will. A lot of function calls sprinkled throughout your site can make it difficult to remove the functionality if you need to.
As far as the onload event goes, it is better to do any DOM manipulation BEFORE document.body.onload, so that if you are replacing images and so forth, they don't need to be completely loaded before they are replaced. It's about bandwidth savings.
So, I thought I'd be clever and trigger my SWF injection script when the DOM is ready, but before the page load completes by using Dean Edwards IE onload solution. Basically, any script that you include with "defer" in the script tag will execute when the DOM has loaded, but before document.body.onload.
Unfortunately, though the swf is injected into the page properly, the Eolas patch is in full effect complete with the "Click to Activate And Use This Control" message. Check out this test page to see it for yourself.
I've tried a bunch of ways around this. It turns out that if the SWF file is already cached, the Eolas garbage goes away, so I could possibly work out some kind of prefetch scheme. If anyone else has come across this and has a solution, let me know!
These two triggers have their downsides. It is often not desirable to put a JS function call within the body of your HTML document, as this makes your code more difficult to maintain. If you have a large site, you probably want a single library that you can snap in and out at will. A lot of function calls sprinkled throughout your site can make it difficult to remove the functionality if you need to.
As far as the onload event goes, it is better to do any DOM manipulation BEFORE document.body.onload, so that if you are replacing images and so forth, they don't need to be completely loaded before they are replaced. It's about bandwidth savings.
So, I thought I'd be clever and trigger my SWF injection script when the DOM is ready, but before the page load completes by using Dean Edwards IE onload solution. Basically, any script that you include with "defer" in the script tag will execute when the DOM has loaded, but before document.body.onload.
Unfortunately, though the swf is injected into the page properly, the Eolas patch is in full effect complete with the "Click to Activate And Use This Control" message. Check out this test page to see it for yourself.
I've tried a bunch of ways around this. It turns out that if the SWF file is already cached, the Eolas garbage goes away, so I could possibly work out some kind of prefetch scheme. If anyone else has come across this and has a solution, let me know!
1 Comments:
Tom,
I might have something for you. I use a similar method for working around the Eolas junk (probably simpler and less robust, but enough for what we need). I ran into the same surprise - IE7 Beta worked fine; IE7 RC1 doesn't respond to the workaround.
I had one of those great moments where the first idea I had seems to work. I haven't had time to do much testing, at all, so this may be full of holes. In fact, the success I've had _could_ be due to the SWF having been cached, so take this with a measure of caution. Something for you to check out, though, at least.
I don't mess around with deferring anything with the workaround I use - mostly because I don't know anything about that. I create a div container for the Flash object, and then inside of the the div I include JS insertion of my external file, which is just a series of 'document.writeln(...)' statements.
That leaves my onload event totally free - I use that to call a single-line function called 'makeKeyPress'. In that function I just simulate a space-bar keypress.
More disclaimer -- I've never messed around with programatic keypresses in JS, so if this is just a competely uninformed and stupid approach, someone please feel free to say point it out.
Not only was I surprised that this actually seemed to work, but the two pieces seem to require each other - that is, the fake keypress doesn't work on its own, and the injection (as we know) doesn't work on its own.
If you'd like, check out a post on a blog my group maintains -- http://coursedev.wordpress.com/2006/09/05/internet-explorer-7/
Hope this turns out to be helpful.
Ross Henderson
Post a Comment
<< Home