![]() |
Question: Can I play a sound file without using JavaScript?
Answer:
Yes, you can play a sound by specifying the sound file's URL
as a hyperlink destination, for example,
<A TARGET=_blank HREF="mySound.mid">
(click here to try it).
When the user clicks the hyperlink,
the browser will open a separate sound control window (or tab).
The user will then have to close this window/tab manually.
What's worse, every time the user clicks the hyperlink,
the browser will open a new sound control window or tab -
even though there might be several others already playing the same file!
To use only one additional window/tab for audio playback, you can specify a TARGET
other than "_blank"
, for example:
<A TARGET="player_window" HREF="mySound.mid">Play me!</A>
Try this in action now: this link opens only one window for audio playback. This is much better!
Copyright © 1999-2011, JavaScripter.net.