JS: How to Detect Adobe Flash, QuickTime?

By Xah Lee. Date: . Last updated: .

here's how to detect if browser supports Adobe Flash.

//plugin detection for Internet Explorer
function hasIEPlugin(objname){
    try {
        new ActiveXObject(objname);
        return true;
    } catch (ex) {
        return false;
    }
}

function hasFlash() {
    for (var i=0; i < navigator.plugins.length; i++) { if (navigator.plugins[i].name.toLowerCase().indexOf("flash") > -1){ return true; } }
    return hasIEPlugin("ShockwaveFlash.ShockwaveFlash");
}

console.log( hasFlash());

Try to disable flash plugin in your brower and reload this page. [see How to Disable JavaScript, Flash, Java in Google Chrome, Firefox, Internet Explorer]

Detect QuickTime

function hasQuickTime() {
    for (var i=0; i < navigator.plugins.length; i++) { if (navigator.plugins[i].name.toLowerCase().indexOf("quicktime") > -1) { return true; } }
    return hasIEPlugin("QuickTime.QuickTime");
}

The hasIEPlugin code is from [Professional JavaScript for Web Developers by Nicholas Zakas. At Buy at amazon ]

BUY ΣJS JavaScript in Depth