Embedding Objects in HTML

Embedding objects in HTML is sometimes necessary! This is because of few rules or regulations framed in some of the sites that never allow to promote commercial links or to attract traffic directly. Therefore, embedding objects, considered as a part of internet marketing strategy, can be done by following certain metatagging method and by following a list of specific html commands. In the process of <embed>, the browser plugin in the page and this plugin is considered as a special program stored at the client computer that handles a special type of data file. Generally sounds and movies are the common plugins and the tag <embed> gives a special location of the data file.

With embedding link, the primary advantage is that the link will be much shorter and it will get download faster on the recipient’s computer.

  • With embedded link, the recipient can open the images/sounds/video files while reading the document
  • They can read the normal text version of the site instead the reading the complex HTML version.
  • The viewer can see the images/sounds/video whenever they visit the site
  • The sounds and images can be visible even when the user has turned off the images.

Simple to use, the <embed> apply SRC attribute for locating the plugin data file and also includes the ‘width’ and ‘height’ of the plugin object. Let’s consider the following example:

1
<embed src="../graphics/sounds/1812over.mid" height=60 width=144>

Here, the embedding in done with the SRC command where the path of the audio file has been mentioned along with the height and width of the place where the resource will appear. <Embed> is not considered as a part of the xHTML 1 specifications or HTML4, but they are well supported by all modern browsers. Sometimes the type of the <embed> depends on the plugin you are using. Therefore one of the most essential attribute for <embed> is SRC which indicates the media object to be embedded. For example:

1
<embed src="../graphics/sounds/1812over.mid" height=60 width=144>

Check out the following list from which you can use the codes while embedding.

  • src: url of resource to be embedded
  • width: width of area where the resource will appear
  • height: height of area where the resource will appear
  • align: the flowing of text around the picture
  • name: name of the embedded object
  • pluginspage: the source of the plugin software
  • pluginurl: to locate the jar archive for automatic installation
  • hidden: if you want to hide the object
  • href: make this object a link
  • target: put a link to
  • autostart: a sound/movie that automatically starts
  • loop: the number of repetition of sound/movies
  • playcount: the number of times sound/movies will play
  • volume: the audio level of the sound/movies
  • controls: controls display of the video
  • controller: display of control, if required
  • mastersound: the object sound within a sound group
  • starttime: the start and stop of sound/video
  • endtime: time to finish the play

Here are few examples of codes for embedding objects in HTML:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<object data="flash_object.swf" type="application/x-shockwave-flash" width="320" height="240">
    <param name="movie" value="flash_object.swf"/>
    <param name="bgcolor" value="#FFF"/>
    Flash player is not installed.
</object>
<object data="quicktime_movie.mov" type="video/quicktime" width="320" height="256">
    <param name="src" value="quicktime_movie.mov"/>
    <a href="quicktime_movie.mov">View this video</a>
</object>
<!--Using HTML 5 video element:-->
<video src="video.ogg" type="video/ogg" controls>
<code>video</code> element or media type is not supported