browserHasFlashSupport()

by web-nfo.com

HTML

<div id="output"></div>

CSS

* { font-size:15px; font-family:arial,tahoma,'sans serif'; }

JavaScript

function browserHasFlashSupport()
{
	var hasFlash = false;
	if(
		typeof navigator != "undefined" &&
		typeof navigator.plugins != "undefined" &&
		typeof navigator.plugins["Shockwave Flash"] == "object" &&
		navigator.plugins["Shockwave Flash"].description &&
		(
			typeof navigator.mimeTypes != "undefined" &&
			typeof navigator.mimeTypes["application/x-shockwave-flash"] != "undefined" &&
			navigator.mimeTypes["application/x-shockwave-flash"] &&
			typeof navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin != "undefined" &&
			navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin
		)
	){
		hasFlash = true;
	}
	else if(typeof window.ActiveXObject != "undefined"){
		try {
			var a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			if (a){
				hasFlash = true;
			}
		}
		catch(exception){}
	}
	return hasFlash;
}


/* TEST */
var html = "Shockwave Flash Support: <strong>" + browserHasFlashSupport() + "</strong>"
document.getElementById('output').innerHTML = html;