Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Playing a sound 1

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
Is there a way of playing a short alert sound in all browsers without plug-ins, strap ons or any additional apps?

Keith
 
That depends on whether you also have external media players installed, I'd say (e.g. Quicktime or Windows Media Player).

In IE, you could use BGSOUND, but Fx doesn't understand that, so you'd need to use EMBED and specify a type for the file... but that would rely on the external player (or browser plugin of said player) being able to handle that type.

Have a play with EMBED anyway - it might work for your situation without specific plugins.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Thanks Dan
I need to alert logged in users that an event has taken place but they may not have my web app as their top window. I thought a simple ping, whoosh or tingly noise would be sufficient to alert them that their information is now available.

This code works for IE and Netscape
Code:
<SCRIPT TYPE="text/javascript">
<!-- 
var filename="[URL unfurl="true"]http://www.studiosoft.co.uk/chat/file.wav";[/URL]
if (navigator.appName == "Microsoft Internet Explorer")
    document.writeln ('<BGSOUND SRC="' + filename + '">');
else if (navigator.appName == "Netscape")
    document.writeln ('<EMBED SRC="' + filename + '" AUTOSTART=TRUE WIDTH=144 HEIGHT=60><P>');
// -->;
</SCRIPT>

but of course it does not work in Firefox.
All this progress and we still cannot reliably play a simple sound - bah!

Keith
 
Hi

Keith said:
All this progress and we still cannot reliably play a simple sound - bah!
I am happy for that.

Personally I would use a JavaScript [tt]alert()[/tt]. The users who configured their browser/window manager to play sound/blink the task bar button/whatever, will get the audible/visible notification. The others probably are not interested in getting such notification.

Feherke.
 
Thanks Feherke - great suggestion.
That looks to be the most reliable cross browser method and as the users will be waiting for their information, I can insist that they have Javascript active on their machines or miss out.


Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top