You are here: irt.org | FAQ | JavaScript | Misc | Q482 [ previous next ]
For Netscape - yes. The following demonstrates the ability to detect for a plug-in for the audio/midi mime type:
<script language="JavaScript"><!--
var can_play = false;
var mimetype = 'audio/midi';
if (navigator.mimeTypes) {
if (navigator.mimeTypes[mimetype] != null) {
if (navigator.mimeTypes[mimetype].enabledPlugin != null) {
can_play = true;
document.write('<embed src="sound.mid" hidden=true loop=false autostart=false>');
}
}
}
function playSound() {
if (document.embeds && can_play) {
if (navigator.appName == 'Netscape')
document.embeds[0].play();
else
document.embeds[0].run();
}
}
function stopSound() {
if (document.embeds && can_play)
document.embeds[0].stop();
}
//--></script>
<a href="#" onMouseover="playSound()" onMouseOut="stopSound()"><img src="image.gif" width="100" height="100" border="0"></a>