Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q482 Is there any way to detect plugins?

irt.org | Knowledge Base | JavaScript | Misc | Q482 [ previous next ]

Q482 Is there any way to detect plugins?

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>

Feedback on 'Q482 Is there any way to detect plugins?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.