The swfobject

Posted on | Tyler

Anytime I wanted to embed a flash file to a webpage or HTML file, I would use the swfobject. Why would I use the swfobject? Well the answer is simple. XHTML valid. It’s because of me being strict on validating all my pages as XHTML 1.0 that I choose to embed my flash files with swfobject. The explanation is simple as well.

The old modern classic ways to embed flash files on to webpages are using the tags like EMBED, OBJECT, and PARAM. These tags are deprecated in XHTML 1.0, and are NOT XHTML valid! Whenever I see websites still using these tags, I just shake my head and tell myself that it’s not XHTML valid, and be bitter about it. Using the swfobject is more simple to use, and more efficient as it uses the JavaScript language, and easily works with most of your flash files, if configured correctly. You can use the swfobject to embed YouTube videos, for example. With the proper understanding and syntax, you can embed almost any flash file. Games, videos, media players, etc. You just have to know what you’re doing.

If you look at some embed codes for flash files, they give you an IFRAME tag that you can put into your webpage as well. This will pass XHTML validation, but some codes might give you attributes that XHTML does NOT allow. Some of these include “allowTransparency”, and “allowFullscreen”, which do not pass XHTML validation as those attributes do not exist. You are of course allowed to remove those attributes and have it pass as XHTML valid, but if you are a true coder, the swfobject is the way to go.

Did you like this? Share it: