判断浏览器类型与是否安装了flash插件(兼容chrome,firefox,IE)
<html> <head> <SCRIPT type=text/javascript> window.onload=function(){ var swf; if(navigator.userAgent.indexOf("MSIE")>0) { try { var swf=new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); alert("已安装插件"); } catch(e) { alert("没有安装插件"); } } if(navigator.userAgent.indexOf("Firefox")>0 || navigator.userAgent.indexOf("Chrome")>0){ swf=navigator.plugins["Shockwave Flash"]; (swf)?alert("已安装插件"):alert("没有安装插件"); } }; </script> </SCRIPT> <body> </body> </html>