如何用JavaScript判断客户端浏览器是否安装了Flash插件,及其版本?
<SCRIPT LANGUAGE="JavaScript">
<!--
var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
(swf) ? document.writeln('你已经安装了插件') : document.writeln('你没有安装插件');
// -->
</SCRIPT>
**************************************************************************
<script type="text/javascript" language="JavaScript">
<!-- start JS detection
FlashMode = 0;
if (navigator.plugins && navigator.plugins.length > 0)
{
if (navigator.plugins["Shockwave Flash"])
{
var plugin_version = 0;
var words = navigator.plugins["Shockwave Flash"].description.split(" ");
for (var i = 0; i < words.length; ++i)
{
if (isNaN(parseInt(words[i])))
continue;
plugin_version = words[i];
}
if (plugin_version >= 5)
{
var plugin = navigator.plugins["Shockwave Flash"];
var numTypes = plugin.length;
for (j = 0; j < numTypes; j++)
{
mimetype = plugin[j];
if (mimetype)
{
if (mimetype.enabledPlugin && (mimetype.suffixes.indexOf("swf") != -1))
FlashMode = 1;
// Mac wierdness
if (navigator.mimeTypes["application/x-shockwave-flash"] == null)
FlashMode = 0;
}
}
}
}
}
if (FlashMode == 1)
{
document.write('有FLASH的HTML');}
else {
document.write('无FLASH的HTML'); }