简体   繁体   English

Firefox和IE9的Flash网站错误(但可在IE6上使用!)

[英]flash website bug with firefox and IE9 (but works on IE6 !)

my website does not work on firefox (firefox 4 or 7), nothing appears, even not the alternative content 我的网站无法在Firefox(Firefox 4或7)上运行,什么也没有出现,甚至没有替代内容

and with IE9, the problem is the content is compacted at the top of the page... (but it works on IE6 !) 并使用IE9,问题是内容在页面顶部被压缩...(但它在IE6上有效!)

and the html is : 和html是:

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>

        <link rel="stylesheet" type="text/css" media="all" href="style.css" />
        <script type="text/javascript" src="jquery-1.5.1.min.js"></script>
        <script type="text/javascript" src="jq.js"></script>
        <script type="text/javascript" src="swfobject.js"></script>
        <script type="text/javascript">
            swfobject.registerObject("myId", "9.0.115", "expressInstall.swf");
        </script>
    </head>
    <body>

    <div id="flash">

    <object id="myId" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%">
        <param name="movie" value="ombre.swf" />
        <!--[if !IE]>-->
        <object type="application/x-shockwave-flash" data="ombre.swf" width="100%" height="100%">
        <!--<![endif]-->
          <p>alternative content</p>
        <!--[if !IE]>-->
        </object>
        <!--<![endif]-->
      </object>

      </div>

    </body>
    </head>
</html>

and the css : 和CSS:

body {
    width:100%; height:100%; margin:0; background:white; overflow:hidden;
}

it seems to be a problem with the "height" set to 100% but what else can i put? 将“高度”设置为100%似乎是一个问题,但是我还能放什么呢? the website works on chrome, safari, ie6... 该网站适用于chrome,safari,ie6 ...

thanks 谢谢

Since you are using swfObject why are you not using it to do your actual embedding 由于您使用的是swfObject,为什么不使用它来进行实际的嵌入
You will find the following code example to be much more browser compliant. 您将发现以下代码示例与浏览器更加兼容。

<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
  function loaded() {
    var flashvars={}, params={}, attributes={}, tmp, version, width, height, container, flashObj;

    flashvars.UserId = "23061";

    params.menu = "true";
    params.quality = "high";
    params.bgcolor = "#869ca7";
    params.allowscriptaccess = "always";
    params.allownetworking = "all";

    attributes.id = "myId";
    attributes.name = "myId";
    attributes.align = "middle";
    attributes.allowscriptaccess = "always";
    attributes.allownetworking = "all";

    tmp = "expressInstall.swf";
    version = "9.0.115";
    width = "100%";
    height = "100%";
    container = "replaceMe";
    flashObj = "myId.swf";

    swfobject.embedSWF(flashObj, container, width, height, version, tmp, flashvars, params, attributes);
  }

</script>

  <body onLoad="loaded()" >
    <div id="replaceMe">Loading content.</div>
  </body>

[EDIT] [编辑]
Try this out 试试看

<style>
html, body{
  width:100%;
  height:100%;
  margin:0;
  background:white;
  overflow:hidden;
}
</style>

I had this same problem recently, I had set the height and width to 100% and firefox would not display IE9 would squish the swf to the top of the page height:100px or something. 最近我遇到了同样的问题,我将高度和宽度设置为100%,并且Firefox无法显示IE9会将swf压缩到页面顶部height:100px之类。 I fixed it with JavaScript, actually jQuery (simply because it was available): 我使用JavaScript(实际上是jQuery)对其进行了修复(仅因为它可用):

Essentially FF doesn't like % values when you size things, and IE9 has a different problem. 从本质上讲,当您调整大小时,FF不喜欢%值,而IE9存在另一个问题。 If you added static values you wouldn't have a problem. 如果添加了静态值,则不会有问题。 But we don't want static values do we? 但是我们不想要静态值吗?

Anyways, I solved my issue by telling the JavaScript to write the Flash tag for me and insert static values based on the screen size. 无论如何,我通过告诉JavaScript为我编写Flash标签并根据屏幕尺寸插入静态值来解决了我的问题。

<script type="text/javascript">
    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="' + $(window).width() + '" height="' + Math.round(($(window).width()*11)/24) + '" id="YourMovieID" align="middle">
    <param name="movie" value="YourMovie.swf"/>
    <param name="wmode" value="opaque" />
    <param name="scale" value="exactfit" />
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="YourMovie.swf" width="' + $(window).width() + '" height="' + Math.round(($(window).width()*11)/24) + '" >
    <param name="movie" value="YourMovie.swf"/>
    <param name="wmode" value="opaque" />
    <param name="scale" value="exactfit" />
    <!--<![endif]-->
    <!--[if !IE]>--></object>
    <!--<![endif]-->
    </object>')
    </script>

I used $(window).width() to get the width of the screen and then Math.round(($(window).width()*11)/24) because the proportions of my movie were 24X11. 我使用$(window).width()来获取屏幕的宽度,然后使用Math.round(($(window).width()*11)/24)因为电影的比例是24X11。

Again this was my jQ solution because it was available, you could use screen.width to get it. 同样,这是我的jQ解决方案,因为它可用,您可以使用screen.width来获取它。 You might have to condense everything to one line though I just spaced it so you could see what's going on. 尽管我只是将它们隔开,但您可能必须将所有内容压缩到一行,以便您可以看到发生了什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM