SWFObject/Internet Explorer abort message and fixes
Another issue that we ran into recently when launching a site that used Flash was an error message in Internet Explorer 7 on a PC (Vista for me). When trying to access the home page, the following error was displayed: “Internet Explorer cannot open the Internet site . . . Operation aborted” and killed the page rendering and showing a page cannot be displayed message. This, of course, made the homepage inaccessible.
When doing a Google search, I came across several articles with possible reasons for the error and possible fixes. A couple of the explanations were:
The problem is you can’t append to the body element from script that isn’t a direct child to the body element. It can be fixed simply by putting defer=”defer” in the script tag.
According to the W3C, the defer attribute:
When set, this boolean attribute provides a hint to the user agent that the script is not going to generate any document content (e.g., no “document.write” in javascript) and thus, the user agent can continue parsing and rendering.
Blog post by Eoghan O’Brien and also explained in Aral Balkan’s blog post
I tried adding the defer=”defer” attribute to the script tag and it solved the issue on my computer, but the client was still seeing the abort message. Further searching turned up a couple of other reasons:
This post mentioned a conflict between SWFObject and MooTools and this post mentioned a conflict with the DOM model being loaded. When trying these exact solutions inline with my HTML code it did not work, but moving the function to the <head> tag and using an onLoad call in the <body> tag, I was able to solve the issue.
Your method of solving the issue may be different from mine, but so far this is what worked:
1. In the <head> tag, use a function similar to this to load the flash using SWFObject:
<script type="text/javascript" defer="defer"> function loadVideo() { var so = new SWFObject("main.swf", "hp", "150", "150", "9", "#FFFFFF"); so.write("flash-layer"); } </script>
2. Add an onLoad event to the <body> tag similar to:
<body onload="loadVideo();">
Any readers out there that have this issue, find this post and find a solution, I would be interested in hearing what worked for you!
September 19th, 2008 Posted in Development, Technology, UncategorizedTags: abort message, Internet Explorer 7, MooTools, SWFObject
Sorry, comments for this entry are closed at this time.