50 CHAPTER 2 Getting started with HTML5
The following is an example of creating an image map with its areas and assigning the
image map to an image.
<img src ="worldmap.gif" width="145" height="126"
alt="World Map" usemap ="#countries" />
<map name="countries">
<area shape="rect" coords="10,15,30,25"
href="USA.html" alt="USA" />
<area shape="circle" coords="95,40,20"
href="China.html" alt="China" />
<area shape="poly" coords="97,76,115,76,113,83,105,90,97,76"
href="Australia.html" alt="Australia" />
<area shape="default" href="InvalidChoice.html" alt="Invalid" />
</map>
Embedding plug-in content
You can use the <object> and <embed> elements to embed content from plugins. Why are
there two tags for the same purpose? The reason is the differences in browsers over the years.
Originally, Netscape created the <embed> tag for Netscape-style plug-ins, and Internet
Explorer added support for the <embed> tag. The <object> tag was added to HTML 4.0 with
the benefit of supporting Internet component downloads so that the plug-in could be auto-
matically downloaded and installed.
The <embed> tag
Although the HTML 4.01 specification did not support the <embed> tag, most browsers
continued support due to the installed base and the ease of use. In HTML5, both tags exist.
The <object> tag provides more functionality, whereas the <embed> tag is easier to use. For
example, if you want to play a Flash file, you can use the <embed> tag as follows.
<embed src="myFlashFile.swf" >
</embed>
The <embed> tag has the following attributes.
■■height pecifies the height in pixels of the embedded contentS
■■src pecifies the URL of the external file to embedS
■■type pecifies the MIME type of the embedded contentS
■■width pecifies the width in pixels of the embedded contentS
For browsers that don’t support the <embed> tag, you can add fallback content into the
element as follows.
<embed src="myFlashFile.swf" >
<a href="/go/getflashplayer/">
<img src=http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif
alt="Get Adobe Flash player" />
</a>
</embed>