Unlimited Plugins, WordPress themes, videos & courses! Unlimited asset downloads! From $16.50/m
  1. Code
  2. HTML & CSS

Quick Tip: Insert Flash the Correct Way

Read Time:2 minsLanguages:

You create your site the right way. You follow all of the rules, so that in the end, you can proudly have a link to w3's validator, confirming your site's perfection. There's just one problem: if you embed any flash into your page, you'll get several errors. That's because the embed tag is not a valid tag. You need to insert your flash the correct way!

What Not To Do

This is the simplified version. If you generate the default HTML web page directly from flash, it's ten times more ugly. In fact, it just might be longer than this article - Just to embed a single flash file! And it doesn't even do it with valid HTML (in fact 19 errors).


This is the result. As you can see, there are 6 errors. All 6 from the embed element (5 from the
attributes, and 1 from the tag itself)

What You Should Do

First of all, you shouldn't use the embed tag at all. Forget it! Since we don't have "embed" any more, we're only left with the object tag. It's a good thing that all browsers support it in some way!

Within the Object tag we will use the following attributes:





We'll need to specify the MIME type of what we're inserting. In this case, we're inserting flash. So for the type attribute, we specify "application/x-shockwave-flash". We declare the source through the data attribute. I think everyone can guess what the width and height attributes do. So this is how you should insert your flash, for validity:

You still need the <param> tag as well. Let's test this new code now:


Final Words

Isn't that "congratulations page" just so...validating? No pun intended. Anyway, I hope you found this to be useful, and have a great week!

Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.