木子屋 Dnawo's BLOG

Flash版本检测

👤 dnawo 📅 2008-06-19 👁 5695 👍 0 💬 0 🔄 来源:百度空间
function flashChecker()
{
	var hasFlash=0;         	//是否安装了flash
	var flashVersion=0;			//flash版本
	var isIE=/*@cc_on!@*/0;      //是否IE浏览器

	if(isIE)
	{
		var  swf  = null;
		try{ swf=  new  ActiveXObject('ShockwaveFlash.ShockwaveFlash');  }catch(e){}
		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= null;
			try{ swf=navigator.plugins["Shockwave Flash"]; }catch(e){}
		    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};
}

评论(0)

暂无评论。

计算题
评论需审核通过后显示
← 上一篇 IE中的条件注释 下一篇 → Excel 已经检测到"test.csv"是SYLK文件,但是不…