1、js檢查flash版本升級javascript
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; } }
2、js判斷是否安裝flash player及當前版本html
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");
3、Flex 使用swfobject判斷FlashPlayer是否安裝,以及播放器版本java
<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>