js 客户端如何判断浏览器是否暗转Flash

时间:2023-03-09 06:06:35
js  客户端如何判断浏览器是否暗转Flash

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<script>
//自己总结的
//IE中判断是否安装插件
var swf;
function IE_Flash()
{
try
{
var swf=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
alert("已安装插件");
}
catch(e)
{
alert("没有安装插件");
}
}
//FireFox,Chrome中判断是否安装插件
function FF_or_Chrome_Flash()
{
var swf=navigator.plugins["Shockwave Flash"];
(swf)?alert("已安装插件"):alert("没有安装插件");
}
</script>
<body onload="IE_Flash()">

</body>
</html>