You are here: Home / Dog Blog / Archives

Flash and Web Standards

Wednesday 21 April, 2004 (10:50AM GMT)

Firstly a warning: I am no Flash expert by any stretch of the imagination. In fact, I avoid it like the plague whenever possible.

But, you know, sometimes you have to embed a Flash movie in HTML. It's quite commonly recognised that the method provided by Macromedia is completely inadequate because it involves the embed tag. Crap.

But then Drew McLellan came up with 'Flash Satay' that involves using only object tags. Great. That's what they're there for. But this method requires fiddling with the Flash movie itself because of IE's problems with streaming.

Now Hixie's come up with a valid, non-embed method, which relies on Internet Explorer's conditional comments. Proprietary ugliness.

From what I understand, the following code (taken from 'Flash Satay') should work but by using it, IE simply won't stream:

<object type="application/x-shockwave-flash" data="movie.swf">
<param name="movie" value="movie.swf" />
</object>

To get around the streaming problem, IE needs the classid and codebase attributes, but these mess up the whole thing for other browsers. And this is where Hixie's method works.

As far as I can see, the best way to embed Flash in HTML is to serve up different code to different browsers using PHP, ASP or whatever.

Again, not perfect by any means.

There has to be a better way...

Comments

Comment 1

How would you serve an image when the client has no flash plug-in installed ?

You have to do the test in the client-side, using JavaScript or Flash. Is there any "pure HTML" away?

Do you know any links where these isues are discussed?

So said ssn on Wednesday 21 April, 2004 at 12:19PM GMT.

Comment 2

My method doesn't use any proprietary stuff. The fact that IE chokes on my perfectly valid comments and therefore works around a bug in its <object> handling is pure coincidence (*cough*).

So said Ian Hickson on Wednesday 21 April, 2004 at 1:08PM GMT.

Comment 3

Just use the embed tag. If you sacrafice browser compatibility for standards, that really shows me that you don't care about making websites, and that you're a conformist to the W3C.

Write for browsers, not for standards.

So said Dante Evans on Thursday 22 April, 2004 at 1:16AM GMT.

Comment 4

But you can do it without the embed tag.... It's not sacrificing anything.

Either of those methods mentioned above are better than the Macromedia suggestion, even forgetting about standards.

Writing for standards *is* writing for browsers. *All* browsers.

So said Patrick on Thursday 22 April, 2004 at 8:45AM GMT.

Comment 5

Hixie, your method is easily the best I've seen but it's still not perfect. It's a shame you need to add two sets of tags repeating the URL etc etc. Your method is the one I'd use to this date though.

I've been trying to do something using the DOM to rewrite the object tag if it needs to but so far Im not having alot of success. Very tricky problem for something that should be so simple.

So said Dan Webb on Thursday 22 April, 2004 at 9:22AM GMT.

Comment 6

I use the Flash Satay and as long as you use the extra Flash file (which is supplied) to trigger the streaming, it all seems to work nicely.

Hey, the way I see it is that sometimes you feed a paramter into a containing SHTML, PHP, whatever page and use that to pump out what you want. Is using a container flash file really that bad? It's annoying, but the same container flash file can be used over and over again. Have never edited nor needed to edit any Flash file to use it.

So said Andrew on Tuesday 27 April, 2004 at 4:56PM GMT.

Comment 7

I use this code and it appears fine in all browsers in which it was tested, including IE:

<object type="application/x-shockwave-flash" data="mymovie.swf" width="200" height="200">
<param name="movie" value="mymovie.swf" />
<!-- Non-Flash content goes here -->
</object>

So said Kim Siever on Thursday 13 May, 2004 at 4:26PM GMT.

Comment 8

The problem with that Kim is that the movie won't stream.

So said Patrick on Thursday 13 May, 2004 at 4:33PM GMT.

Comment 9

What peoples thoughts on embedding Flash using JavaScript like http://www.receiverstudio.com/ uses?

So said Nathan Searles on Thursday 13 May, 2004 at 9:02PM GMT.

Comment 10

From what I understand about receiverstudio.com's javascript is that it checks first to see if the clients browser has the latest flash plugin installed. Also, the object and embed tags were used and look as if they were generated.

So said Farrel Hardenberg on Thursday 20 May, 2004 at 2:18PM GMT.

Comment 11

There is a bug everyone should be aware of when using this method:

Safari will ignore your 'param' tags inside the object tag, so if you want to use any special parameters for the plugin, like flashvars or wmode or salign they will not work properly in Safari.

The best way to get around this is to use javascript to embed your movies. this way you can do the Flash plugin detection as well, which is more thorough since you can check flash versions and not just whether they have the Flash plugin installed or not.

Here's a js flash embed i developed:
http://blog.deconcept.com/2004/10/14/web-standards-compliant-javascript-flash-detect-and-embed/

So said Geoff on Tuesday 4 January, 2005 at 4:14PM GMT.

Comment 12

I like the hixie idea. There are 2 problems I see with it.

1. (This problem exists with the current method) There are still 2 separate instances, so there is no way to identify the flash, via an id="" attribute. I guess you could give both separate id's and just use both in all cases, but this begins getting stupid.

2. Just a slight refinement. Why not put additional type of material outside of the conditionals? What happens if they have IE, but don't have flash enabled (the whole point of putting the stuff there) If you put your or alt text after the condtionals, like







Alternate content


This should work for all platforms, because Moz or Opera should ignore the first , go onto the next. if it is disabled, then it will go onto the next item in list, which is the "Alternate Content". At least that is how I remember the object tag is supposed to work.

So said Josh Walker on Wednesday 16 March, 2005 at 8:38PM GMT.

Comment 13

Anyone know how to embed flash into myspace? I've heard they strip out params, and this won't allow me to also embed an xml file with the flash. ANyone know?

So said Amir Meshkin on Sunday 30 October, 2005 at 5:59AM GMT.

See Also

^ Top

SiteGround: Fast, reliable, recommended hosting.