本文介绍了swfobject.embedSWF不工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的代码使用SWFObject将Flash动画嵌入到HTML文档中仅显示替代内容。为什么?

 <!DOCTYPE html> 
< html>
< head>
< title>添加Flash电影< / title>
< script type =text / javascript
src =http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js>
< / script>
< script type =text / javascript>
swfobject.embedSWF(flash / bird.swf,bird,400,300,8.0.0);
< / script>
< / head>
< body>
< div id =bird>
< p>一只正在洗澡的鸟的动画< / p>
< / div>
< / body>
< / html>

Chrome,IE和Firefox都只显示一只鸟的动画淋浴



代码 &安培; CSS:设计和构建网站。

解决方案

SWFObject 2.2不再正常工作。 GitHub上已经报告了,但该库没有维护。 / p>

从Chrome 55开始的新默认HTMLFlash策略不会初始化SWFObject用于检测Flash是否已安装的变量。具体来说,除非用户启用了Flash,否则 navigator.mimeTypes 不再包含 application / x-shockwave-flash 。其他浏览器也存在与作为。

目前,最好的行动方式可能是简单地使用< object> 嵌入Flash。例如:

 < object type =application / x-shockwave-flashdata =app.swf> 
< param name ='movie'value =app.swf/>
< param name ='bgcolor'value =#999999/>
< param name ='FlashVars'value =var1 = Hello& var2 = Goodbye/>
< param name ='allowscriptaccess'value =sameDomain/>
< / object>

注意:(1).swf在两个地方指定(2)只有 movie param是必需的;其他参数在这里显示为可能的例子。


The following code embedding a Flash animation into an HTML document using SWFObject displays only the alternative content. Why?

<!DOCTYPE html>
<html>
    <head>
        <title>Adding a Flash Movie</title>
        <script type="text/javascript"
                src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js">
        </script>
        <script type="text/javascript">
            swfobject.embedSWF("flash/bird.swf", "bird", "400", "300", "8.0.0");
        </script>
    </head>
    <body>
        <div id="bird">
            <p>An animation of a bird taking a shower</p>
        </div>
    </body>
</html>

Chrome, IE and Firefox all show just An animation of a bird taking a shower.

The code is a sample from the book HTML & CSS: design and build websites.

解决方案

SWFObject 2.2 no longer works properly. The bug in SWFObject has already been reported on GitHub, but the library is unmaintained.

The new "HTML by default" Flash policy starting at Chrome 55 does not initialize the variables that SWFObject uses to detect whether Flash is installed. Specifically, navigator.mimeTypes no longer contains application/x-shockwave-flash, unless Flash is enabled by the user. Other browsers have similar issues related to the click-to-run activation scheme introduced as part of Flash’es end of life.

At this time, the best course of action may be to simply use <object> to embed Flash. For example:

<object type="application/x-shockwave-flash" data="app.swf">
    <param name='movie' value="app.swf"/>
    <param name='bgcolor' value="#999999"/>
    <param name='FlashVars' value="var1=Hello&var2=Goodbye" />
    <param name='allowscriptaccess' value="sameDomain"/>
</object>

Note that (1) the .swf is specified in two places (2) only the movie param is required; the other params are shown here as an example of what is possible.

这篇关于swfobject.embedSWF不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 20:02