1

我不太了解下载的 SWFObject 示例 http://download.macromedia.com/pub/developer/alternative_content_examples.zip'>here。

为什么只能通过 <|--[if !IE]> --> 指令检查 flash 插件的可用性。这是否意味着只有 IE 可以没有预装的 flash 播放器?当然不。那为什么只检查 IE 呢?

4

1 回答 1

1

不!该代码并不意味着它只检查 IE。

zip中有两个例子,第一个是

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="728" height="90" id="myFlashContent">
    <param name="movie" value="banner.swf" />
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="banner.swf" width="728" height="90">
    <!--<![endif]-->
        <img src="banner.jpg" alt="Alternative content rules!" />
    <!--[if !IE]>-->
    </object>
    <!--<![endif]-->
</object>

第二个是:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="480" height="270" id="myFlashContent">
    <param name="movie" value="movie.swf" />
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="movie.swf" width="480" height="270">
    <!--<![endif]-->
        <ol>
            <li><img src="frame1.jpg" alt="" />It's night-time, a UFO flies over the pasture, cows grazing</li>
            <li><img src="frame2.jpg" alt="" />The UFO tries to abduct two cows using a tractorbeam, however the cows appear to be too heavy to be lifted off the ground</li>
            <li><img src="frame3.jpg" alt="" />It's daytime again, cows are still grazing, one cow looks very relieved</li>
        </ol>
    <!--[if !IE]>-->
    </object>
    <!--<![endif]-->
</object>

<!--[if !IE]>--><!--<![endif]-->作为一对工作。他们就像if (!isIE){ //... }. 它的意思是 IE 将忽略该对中的代码(注意!这意味着“不是”)。它们实际上与 Flash 检测无关。

Flash 检测(实际上是优雅降级)是通过使用当插件不存在时,它的 object/embed 标签将被忽略并显示这些标签内的 HTML 的特性来完成的。

如果 Flash 不存在,<img src="banner.jpg" alt="Alternative content rules!" />则将显示第一个。第二个是

<ol>
    <li><img src="frame1.jpg" alt="" />It's night-time, a UFO flies over the pasture, cows grazing</li>
    <li><img src="frame2.jpg" alt="" />The UFO tries to abduct two cows using a tractorbeam, however the cows appear to be too heavy to be lifted off the ground</li>
    <li><img src="frame3.jpg" alt="" />It's daytime again, cows are still grazing, one cow looks very relieved</li>
</ol>
于 2009-10-16T13:55:14.700 回答