檢測瀏覽器是否安裝flash
問題;
flash外掛播放問題
解決:
<SCRIPT LANGUAGE="JavaScript">
<!--
var swf =new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
(swf) ? document.writeln('你已經安裝了外掛') : document.writeln('你沒有安裝外掛');
// -->
</SCRIPT>
動態載入flash
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="mFlash"
codebase="
WIDTH="120" HEIGHT="60" id="468x60" ALIGN="" VIEWASTEXT>
<PARAM NAME=quality VALUE=high>
</OBJECT>
<input type=button onclick="addFlash()" value="Add">
<input type=button onclick="mFlash.Stop()" value="Stop">
<input type=button onclick="mFlash.Play()" value="Play">
<script>
function addFlash() {
mFlash.movie="
mFlash.Play();
}
</script>
使用者自主選擇安裝flash
<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
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'); }
// end JS detection -->