Good Manners for Adobe Flash on Linux

Today, I had to deal with some badly behaving Flash content. The debugging process involved some extensive use of google and brought out a few interesting facts, which I thought would be good to be put together into a coherent story.

Webpages that embed Flash together with other layers of Web page content generally suck – in particular on Linux. It’s not the Web design that sucks – in fact: being able to use “depth” in a Web page is actually really nice for fitting more content on a page without making it too crowded (or hammering those flash ads at us – sigh).

Indeed, it is the technology that sucks because Flash on Linux doesn’t do what it’s supposed to do. Flash misbehaves on Linux by being bullish and always trying to stay dominant in the foreground over the top of DHTML content, even though being told not to. Don’t be prejudiced though: it’s not Adobe’s fault – or at least “not only”.

Before we try to teach Flash good manners, let’s first understand the problem.

When you embed an Adobe Flash 9 swf file in a Web page, Adobe provides a parameter called “wmode” (windowless mode), through which Flash is being told to be either “transparent” or “opaque”, either of which will prevent a Flash from playing in the topmost layer and allow you to adjust the layering of the movie within other layers of the HTML document. Layering in HTML is done by using the z-index.

Now, using wmode and “transparent” teaches Flash good manners on most operating systems. However, when the Flash ends up on a Linux computer, it’s old dominant personality returns and it turns evil again.

Yes, it is a bug. However, it is quite an interesting and long-standing bug – and longer-standing in Mozilla than other Linux Web Browsers, too.

Here is the story: On the 12th April 2002, Braden registered Bug 7189 with Mozilla about window-less plugin support on X. It was soon established that in principle window-less support is possible on Linux and the bug was re-focused on Flash. It turned out that multiple levels of fixes were necessary to get this working: at first, X needed window-less plugin support – a patch to fix this was provided by Dec 2004 by Pete Collins. Next thing necessary was support by Adobe to have an active “wmode” parameter, which was provided by end 2006. In April 2007 finally there was a first patch for Mozilla. A later patch was finally applied to trunk on July,2nd 2007. W00t!!

So, while we are all waiting for this patch to make it into Firefox and Linux distributions, to finally end up on our Desktop and make Flash behave, there is indeed a way for keen Web developers around this problem. And I can’t believe I’m actually going to say this: iFrames were the answer to our problem in my July’s blog post – and iFrames are again the answer here. Evil, detested, but oh so useful iFrames. Who would have thought…