一、js检查flash版本升级
for (var i = 0, len = navigator.plugins.length; i < len; i++) {
var plugin = navigator.plugins[i]; if (plugin.name == 'Shockwave Flash') {
if (plugin.filename == 'internal-not-yet-present') {
commFunc.confirm("您当前浏览器flash插件版本较低,可能无法使用系统中导出Excel功能,现在去升级?", function () {
window.open('https://get2.adobe.com/cn/flashplayer/otherversions/');
});
}
break;
}
}
二、js判断是否安装flash player及当前版本
function flashChecker() {
var hasFlash = 0; //是否安装了flash
var flashVersion = 0; //flash版本
if (document.all) {
var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
if (swf) {
hasFlash = 1;
VSwf = swf.GetVariable("$version");
flashVersion = parseInt(VSwf.split(" ")[1].split(",")[0]);
}
} else {
if (navigator.plugins && navigator.plugins.length > 0) {
var swf = navigator.plugins["Shockwave Flash"];
if (swf) {
hasFlash = 1;
var words = swf.description.split(" ");
for (var i = 0; i < words.length; ++i) {
if (isNaN(parseInt(words[i]))) continue;
flashVersion = parseInt(words[i]);
}
}
}
}
return {
f: hasFlash,
v: flashVersion
};
} var fls = flashChecker();
var s = "";
if (fls.f) document.write("您安装了flash,当前flash版本为: " + fls.v + ".x");
else document.write("您没有安装flash");
三、Flex 使用swfobject判断FlashPlayer是否安装,以及播放器版本
<html>
<head>
<script type="text/javascript" src="http://www.hangge.com/swfobject.js"></script> <script>
//flash版本检测
function CheckFlashPlayer(){
var version = swfobject.getFlashPlayerVersion();
if (document.getElementById && version["major"] > 0) {
if(version['major']<10) {
alert("你的flash播放器版本过低!请安装flash Player 10版本!");
return false;
}
}else{
alert("您还未安装flash Player,请安装 flash Player 10版本!");
return false;
}
return true;
} CheckFlashPlayer();
</script>
</head>
<body>
</body>
</html>