Tag Archives: syntax

Html object & embed tags

Maybe almost 90 % of the web developers world wide are using widely the <embed> and <object> HTML tags, but in the most cases do not understand the semantics and syntax of them.

Very well known is that these tags help to put a flash movie into the HTML, but why they are two, and can they be used in other cases remains unanswered.

These tags, in general, are really most used to put flash movie into the web site, and as anyone can guess they are two cause of the differences in the web, specially between the web browsers. The <object> tag helps for the browser who use ActiveX controls to display properly the flash movie. In fact the newest Internet Explorer browsers like 7 version and 8 beta, display the movie correctly even without the <object> tag, but not always those flash movies work in the expected manner. Somethimes there are problems with autoplay or something like that. Especially this can be problematic when using some kind of .flv player. In that case (depending from the player) the movie initialize but the required .flv does not load and play. This was the problem I wrote for in my previous post about Opera and JW FLV Player.

As you may guess the <object> tag can handle much more the flash movie, but as many other entities as there are ActiveX controls.

To be more exact the <object> tag is for Internet Explorer, while the <embed> tag is for Netscape and related to it browsers using Netscape plugin to display a flash movie. More detailed information can be found on Adobe site:

http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_4150

All the specification can be found online but more important is to mention the semantics of some of the attributes.

For both of the tags valid attributes are width and height. They can be either pixels or percentage, which are relative from the element containing the object/embed pair, i.e. if the flash is in a div with fixed width of 800px and the object/embed pair is 100% width the movie will became 800px wide.

Notice: some browsers do not calculate the height correctly when the height is set in percentage.

For the <object> tag only there should be classid, codebase, movie attributes, while for the <embed> tag only is src and pluginspage.

see which attributes are mandatory and which one are not at: object and embed tags revealed