Detecting enabled Flash in HTA with Javascript

Batch, ASP, JScript, Kixtart, etc.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
susanlxk
Posts: 1
Joined: Thu Jun 24, 2010 3:34 am

Detecting enabled Flash in HTA with Javascript

Post by susanlxk » Thu Jun 24, 2010 3:46 am

Scenario: User has disabled Flash in Internet Explorer. An HTML file with the following Javascript is launched in IE and also in an HTA.

Script:

Code: Select all

function isFlashSupported(){
	
     if (window.navigator.plugins && navigator.plugins.length){
	
          return navigator.plugins[Shockwave Flash 6.0] || navigator.plugins[Shockwave Flash];
	
     }
	
     try{
	
          // IE style
	
          return Boolean(new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"));
	
     }
	
     catch(e){
	
          return false;
	
     }
	
}


Results:
When Flash is disabled, returns false when viewed in IE, but returns true when viewed in the HTA.

Desired result:
If the customer has disabled Flash, the HTA should honor that. Is there a way to detect whether Flash is disabled (not just that it's installed)?

Thanks,
Susan

Locked