判断浏览器安装flash与否的方法

方法一:

<script type="text/javascript">
$(function(){
    // U can change this number to check specific version of flash
    var MM_contentVersion = 6;
    var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ?
    navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
    if ( plugin ) {
        var words = navigator.plugins["Shockwave Flash"].description.split(" ");
        for (var i = 0; i < words.length; ++i){
            if (isNaN(parseInt(words[i])))
            continue;
            var MM_PluginVersion = words[i];
            }
            var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
    }
    else if( navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 &&
    (navigator.appVersion.indexOf("Win") != -1) ) {
        //FS hide this from IE4.5 Mac by splitting the tag
        document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
        document.write('on error resume next \n');
        document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
        document.write('</SCR' + 'IPT\> \n');
    }
    if ( MM_FlashCanPlay ) {
        //alert("Flash Detection OK. U can play.");
    }
    else{
        var message = "请先下载flash<br/> 下载: <a href='http://www.adobe.com/go/getflashplayer'><img src='http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='获取 Adobe Flash Player' width='112' height='33' /></a> ";
        var $dialog = $('<div></div>').html(message).dialog({
            autoOpen: false,
            resizable: false,
            title: '提示'
        });
        $dialog.dialog('open');
    }
})  
</script>



方法二:

<div id="swf">
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="549" id="FlashID" title="flash">
        <param name="movie" value="beijing(1).swf" />
        <param name="quality" value="high" />
        <param name="swfversion" value="9.0.45.0" />
        <param name="wmode" value="transparent"/>
        <!-- 此 param 标签提示使用 Flash Player 6.0 r65 和更高版本的用户下载最新版本的 Flash Player。如果您不想让用户看到该提示,请将其删除。 -->
        <param name="expressinstall" value="expressInstall.swf" />
        <!-- 下一个对象标签用于非 IE 浏览器。所以使用 IECC 将其从 IE 隐藏。 -->
        <!--[if !IE]>-->
        <object type="application/x-shockwave-flash" data="beijing(1).swf" width="100%" height="549">
          <!--<![endif]-->
          <param name="quality" value="high" />
          <param name="swfversion" value="9.0.45.0" />
          <param name="wmode" value="transparent"/>
          <param name="expressinstall" value="expressInstall.swf" />
          <!-- 浏览器将以下替代内容显示给使用 Flash Player 6.0 和更低版本的用户。 -->
          <div>
            <h4>此页面上的内容需要较新版本的 Adobe Flash Player。</h4>
            <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="获取 Adobe Flash Player" width="112" height="33" /></a></p>
          </div>
          <!--[if !IE]>-->
        </object>
        <!--<![endif]-->
      </object>
    </div>

附件中有具体的例子。

你可能感兴趣的:(浏览器,Flash,判断安装,两种方法)