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 ]

Liket it? Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials

  1. HTML
  2. Visual CSS
  3. JS in Depth
  4. JS Reference
  5. DOM
  6. SVG
  7. Web Dev Blog