+ -
当前位置:首页 → 问答吧 → test flash version

test flash version

时间:2010-05-20

来源:互联网


<script>(function (){ var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; document.write("<h1>客户端头信息测试: isIe:"+isIE+"|WIN:"+isWin+"|isOpera:"+isOpera+"</h1>"); document.write("<h3>详细头信息appVersion: "+navigator.appVersion+"</h3>"); document.write("<h3>详细头信息userAgent: "+navigator.userAgent+"</h3>"); var versionStr = -1; function ControlVersion(){ var version; var axo; var e; // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry try { // version will be set for 7.X or greater players axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); version = axo.GetVariable("$version"); } catch (e) {document.write('<h4>7失败</h4>');} if (!version) { try { axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); version = "WIN 6,0,21,0"; axo.AllowScriptAccess = "always"; version = axo.GetVariable("$version"); } catch (e) {document.write('<h4>6失败</h4>');} } if (!version) { try { // version will be set for 4.X or 5.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); version = axo.GetVariable("$version"); } catch (e) {document.write('<h4>4,5失败</h4>');} } if (!version) { try { // version will be set for 3.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); version = "WIN 3,0,18,0"; } catch (e) {document.write('<h4>3.0.18失败</h4>');} } if (!version) { try { // version will be set for 2.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); return (axo.GetVariable("$version")); version = "WIN 2,0,0,11"; } catch (e) {document.write('<h4>ActiveX失败</h4>'); version = -1; } } return version; } // JavaScript helper required to detect Flash Player PlugIn version information function GetSwfVer(){ // NS/Opera version >= 3 check for Flash plugin in plugin array var flashVer = -1; if (navigator.plugins != null && navigator.plugins.length > 0) { if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) { var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description; var descArray = flashDescription.split(" "); var tempArrayMajor = descArray[2].split("."); var versionMajor = tempArrayMajor[0]; var versionMinor = tempArrayMajor[1]; var versionRevision = descArray[3]; if (versionRevision == "") { versionRevision = descArray[4]; } if (versionRevision[0] == "d") { versionRevision = versionRevision.substring(1); } else if (versionRevision[0] == "r") { versionRevision = versionRevision.substring(1); if (versionRevision.indexOf("d") > 0) { versionRevision = versionRevision.substring(0, versionRevision.indexOf("d")); } } else if (versionRevision[0] == "b") { versionRevision = versionRevision.substring(1); } flashVer = versionMajor + "." + versionMinor + "." + versionRevision; } } // MSN/WebTV 2.6 supports Flash 4 else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4; // WebTV 2.5 supports Flash 3 else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3; // older WebTV supports Flash 2 else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2; else if ( isIE && isWin && !isOpera ) { document.write("test1:"+ControlVersion()); flashVer = ControlVersion(); document.write("test2:"+flashVer); } return flashVer; } document.write("<h1>ControlVersion 返回: "+ControlVersion()+"</h1>"); document.write("<h1>GetSwfVer 返回: "+GetSwfVer()+"</h1>"); //document.write("<h1>版本: "+versionStr+"</h1><h2>符合 : 暂无</h2>"); })(); </script>
 提示:您可以先修改部分代码再运行
这是我借蓝色理想做的一个测试页...对不住大家=.=浪费你们的感情..

[ 本帖最后由 iceseaboy 于 2010-5-20 17:07 编辑 ]

作者: iceseaboy   发布时间: 2010-05-20

能说一下这个在什么场影可以使用吗

作者: iaw2001200   发布时间: 2010-05-20

。。。

作者: xiaojue   发布时间: 2010-05-20