Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Inserting Audio : Page 2

In this section, you'll learn how to insert audio into your site.


advertisement
Autoplaying Sound
Learn how to jumpstart your pages with some tunes before your page is fully loaded with the META tag in this section.

<meta>

After five seconds, this page will start talking to you. Or at least that's the way it seems. One way to do this, and the way we did it for this page, is through the use of a meta tag.

Meta tags are either a storage bin for data or a way of passing information to the server. In this case, it's a way of passing information to the server. You use a meta tag named "refresh" to force the browser to pull in something else (in this case it's a sound file) automatically from the server after a certain amount of time has elapsed.



The most important thing to remember is that the meta tag must be the very first item in the html file. That means before the HTML tag, before the header tags—everything. Otherwise some browser/server combinations will not play the sound.

To add an automatically playing sound you:
1. Create your sound files,
2. Create your HTML page,
3. Make the meta line:

<META HTTP-EQUIV=refresh CONTENT="#seconds; URL of the sound file">.

  • The first value in the content switch is the number of seconds to wait between loading the sound file.

  • The second value in the content switch is the URL of the sound file that you want to play automatically.

Remember that some of your readers won't necessarily be expecting the sound (unless you include a JavaScript alert button!) so consider the effect sound may have on your reader before selecting this method of adding audio to your site.





Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date