Embedding Flash content in WordPress posts and RSS feeds

Posted by Kerry Turner on September 30, 2009
Filed under: How to
Tags: , , , , , , ,

Another day, another WordPress learning curve. This time, it’s to do with embedding Flash content in your posts and feeds.

What I wanted to do: embed Flash content in my posts in a way that’s XHTML compliant and also works for feeds.

I started with swfobject, the awesome JavaScript library that is standards-compliant, degrades gracefully, offers all the paramaters you could possibly want and cooks your dinner for you (one of these may not be true). Unfortunately, writing the swfobject code directly into my posts didn’t meet one of my requirements: while it worked fine on the site, it did nothing for my RSS feeds.

WP-SWFObject is a plugin that looked promising: it cleverly uses swfobject code when content is viewed on your site but replaces that with <object> and <embed> code when in your feed. I had some initial problems with WordPress adding unwanted paragraph tags to the [SWF][/SWF] code I added to my posts, but I fixed this by putting it on its own line with a containing div around it. So far, so good: XHTML compliant site and a feed full of Flash goodness.

Except, it turns out, it just doesn’t work like that. All feed readers, aggregators and parsers seem to handle Flash in RSS feeds wildly differently. Google Reader, for example, works on a whitelist basis: at present, it’ll show embedded content from Youtube and a few others, but good luck getting your homemade swfs to show up. Feed subscribers might see your swf, a blank space or an error message depending on their setup – not really a gamble I wanted to take.

After all that, I decided that the best way to ensure a consistent experience for feed subscribers would be to point them back to the site whenever there was Flash content involved. Sigh. So, long story short: optimise for your site in whatever way works best for you, and don’t worry about feeds for now. You’re welcome, etc.

Comment