使用 SWFObject 进行 Flash 检测

发布于 2024-08-08 04:26:12 字数 222 浏览 3 评论 0原文

我不太明白 http://download.macromedia.com/pub/developer/alternative_content_examples.zip'> 这里下载的 SWFObject 示例。

为什么仅通过以下方式检查 Flash 插件的可用性 <|--[if !IE]> -->指示。 是不是说只有IE浏览器可以不预装flash播放器?当然不。那为什么 只检查IE?

I don't quite understand the SWFObject examples downloaded http://download.macromedia.com/pub/developer/alternative_content_examples.zip'>here.

Why the availability of the flash plugin is checked only by
<|--[if !IE]> --> instructions.
Does it mean that just IE can be without preintalled flash player? Of course no. Then why
just IE is checked?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

奢欲 2024-08-15 04:26:12

不!该代码并不意味着它只检查 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 (!isIE){ //... }。这意味着 IE 将忽略该对内的代码(注意 ! 表示“不”)。它们实际上与 Flash 检测无关。

Flash 检测(实际上是优雅降级)是通过使用以下特性来完成的:当插件不存在时,其对象/嵌入标记将被忽略,并且将显示这些标记内的 HTML。

如果 Flash 不存在,则对于第一个,替代内容规则!。对于第二个来说,就是

<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>

No! The code doesn't mean it only check IE.

There are two example in the zip, first one is

<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>

second one is:

<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]>--> and <!--<![endif]--> works as a pair. They are just like if (!isIE){ //... }. And what it means is IE will ignore the code inside the pair (pay attention to the ! which means "not"). They are actually not related to Flash detection.

Flash detection(in fact it's graceful degradation) is done by using the characteristic that when the plug-in is not present, its object/embed tag will be ignored and the HTML inside those tags will be displayed.

If Flash is not present, for the first one, <img src="banner.jpg" alt="Alternative content rules!" /> will be displayed. For the second, it's

<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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文