A way to determine browser Flash Player information using JavaScript scripts

  • 2020-03-30 03:32:25
  • OfStack

Today, I studied a bit of Flex technology and did a small Demo. During the test, I found frequent errors. When I checked online, I found that it was caused by the low version of the browser Flash Player (10 or more versions are needed).


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<title>JavaScript Determine browser Flash Player information </title> 
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> 
<script type="text/javascript"> 
function checkFlashPlayer(){ 
var hasFlashPlayer=0; //Determine if Flash Player is installed
var flashPlayerVersion=0; //Flash Player version
if(document.all){ 
var shockWaveFlash = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); 
if(shockWaveFlash) { 
hasFlashPlayer=1; 
flashPlayerVersion=parseInt(shockWaveFlash.GetVariable("$version").split(" ")[1].split(",")[0]); 
} 
}else if (navigator.plugins && navigator.plugins.length > 0){ 
var shockWaveFlash=navigator.plugins["Shockwave Flash"]; 
if (shockWaveFlash){ 
hasFlashPlayer=1; 
var descriptionInfo = shockWaveFlash.description.split(" "); 
for (var i = 0; i < descriptionInfo.length; ++i){ 
if (isNaN(parseInt(descriptionInfo[i]))){ 
continue; 
} 
flashPlayerVersion = parseInt(descriptionInfo[i]); 
} 
} 
} 
return {hasFlashPlayer:hasFlashPlayer, flashPlayerVersion:flashPlayerVersion}; 
} 

if(checkFlashPlayer().hasFlashPlayer){ 
if(checkFlashPlayer().flashPlayerVersion <= 10){ 
if(confirm(" your Flash Player Version is too low, upgrade immediately Flash Player Version? ")){ 
window.location.href="http://get.adobe.com/cn/flashplayer/" rel="external nofollow" rel="external nofollow" ; 
} 
}else{ 
alert(" You install the Flash Player , the current Flash Player Version number: "+checkFlashPlayer().flashPlayerVersion+" . "); 
} 
}else{ 
if(confirm(" You did not install Flash Player Install now? ")){ 
window.location.href="http://get.adobe.com/cn/flashplayer/" rel="external nofollow" rel="external nofollow" ; 
} 
} 
</script> 
</head> 

<body> 
</body> 
</html>

Related articles: