Home > Web Front-end > JS Tutorial > How to use JavaScript scripts to determine browser Flash Player information_javascript skills

How to use JavaScript scripts to determine browser Flash Player information_javascript skills

WBOY
Release: 2016-05-16 16:42:10
Original
1006 people have browsed it

Today I studied some Flex technology and made a small demo. During the test, I found that errors were often reported. I checked online and found that it was caused by a lower version of the browser Flash Player (requires version 10 and above). Regarding this Here’s a summary of how to use JavaScript scripts to determine browser Flash Player information:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<title>JavaScript判断浏览器Flash Player信息</title> 
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> 
<script type="text/javascript"> 
function checkFlashPlayer(){ 
var hasFlashPlayer=0; //判断是否安装了Flash Player 
var flashPlayerVersion=0; //Flash Player版本 
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("您的Flash Player版本过低,立即升级Flash Player版本?")){ 
window.location.href="http://get.adobe.com/cn/flashplayer/" rel="external nofollow" rel="external nofollow" ; 
} 
}else{ 
alert("您安装了Flash Player,当前Flash Player版本号为:"+checkFlashPlayer().flashPlayerVersion+"。"); 
} 
}else{ 
if(confirm("您没有安装Flash Player,立即安装?")){ 
window.location.href="http://get.adobe.com/cn/flashplayer/" rel="external nofollow" rel="external nofollow" ; 
} 
} 
</script> 
</head> 

<body> 
</body> 
</html>
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template