10.07.2017 Views

246996016-HTML5-Step-by-Step

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

310 Chapter 16<br />

Including External Content in Web Pages<br />

<strong>HTML5</strong> introduced the tag which enables you to push external server<br />

content to a Web page. The model is called “push” in contrast to the traditional “pull”<br />

model that is used on the Web, where the Web browser always requests information<br />

from the server. Like the element, as of this writing the tag is<br />

not widely supported in Web browsers; therefore, it’s of limited use for practical Web<br />

programming until new browsers appear and are widely adopted. For more information<br />

on , see http://www.whatwg.org/specs/web-apps/current-work/.<br />

Another method for including external data (and multimedia in this case) is the <br />

tag. Unlike , the tag has wide support across browsers. Even<br />

though wasn’t formalized in the HTML specification until version 5, people<br />

have been using the tag for years due to its cross-browser compatibility.<br />

The tag is frequently used to insert elements such as Flash or background<br />

audio on a Web page. The tag uses several attributes, such as src to define the<br />

resource to embed, type to define the type of content being embedded, and height and<br />

width to set the height and width of the element, respectively.<br />

Using to embed an MP3 file is as simple as this:<br />

<br />

Just as when including any multimedia or other objects in a page, playback is dependent<br />

on the client. While my browser supports playing an MP3 audio file, there’s no guarantee<br />

that another visitor will be able to do so. Therefore, I recommend using only<br />

when absolutely necessary.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!