Hello once again, web friends. Today I bring tidings of Flash preloaders and validity.
You may have noticed that with the embed code from my YouTube article that Flash movie preloaders don’t work in Internet Explorer, and the movie has to load entirely before it even displays at all. This is because Internet Explorer requires a different attribute and the removal of another in the object
tag to let preloaders work properly. However, with different attributes, the Flash movie will not display at all in Firefox, so we must use Internet Explorer’s conditional comments to utilize two different opening object
tags. Behold:
<!--[if !IE]>--><object data="yourmovie.swf" type="application/x-shockwave-flash"
width="320" height="240"><!--<![endif]-->
<!--[if IE]><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
width="320" height="240"><![endif]-->
<param name="movie" value="yourmovie.swf" />
<param name="quality" value="high" />
</object>
The first line is the original that works in both IE and Firefox but doesn’t allow preloaders in IE. The second is the IE-only method that works with preloaders. Note the lack of a data
attribute and the addition of a classid
attribute.
Well, there you have it. Venture forth and embed Flash validly with preload animations!
The Pesky iframe and XHTML Strict
Update: Example code updated. It used the shortened form of
iframe
before, as in<iframe />
. That doesn’t sit well with IE. It now uses<iframe></iframe>
which works. The same goes forobject
. It similarly does not play well with Firefox 4 (perhaps even lower versions) in shortened form.If you’ve done much web work before, you’ve probably, at some time or another, had to use an
iframe
. It’s not pretty, but sometimes it’s the only choice, such as embedding a widget from another site or displaying things such as real estate listings. One of my biggest problems with it is that it doesn’t exist in the spec for XHTML Strict! It exists in Transitional, but I don’t like to use it. That may be good enough for some developers, but certainly not for me. How about you?In Internet Explorer 8 (and possibly IE7, but I have not tested it) and Firefox, you can use the
object
element to embed a web page just like aniframe
; however, IE gives it a thick, lovely border that seems impossible to remove. Here’s the trick: employing IE’s conditional comments, use aniframe
for IE and anobject
for everything else. Here’s an example:Valid XHTML Strict! Make sure to keep your settings the same across both elements to keep it consistent.
Happy coding!
Tags: Conditional Comments, Firefox, Iframe, Internet Explorer, Object, Web Development, XHTML
Posted in Web Standards | Comments Off on The Pesky iframe and XHTML Strict