Firefox 和 IE9 下的 Flash 网站错误(但适用于 IE6!)

发布于 2024-12-11 08:54:49 字数 1630 浏览 0 评论 0原文

我的网站无法在 firefox(firefox 4 或 7)上运行,什么也没有出现,甚至没有替代内容

,而对于 IE9,问题是内容被压缩在页面顶部...(但它可以在 IE6 上运行!)

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>

css :

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

这似乎是“高度”设置为 100% 的问题,但我还能放什么?该网站适用于 chrome、safari、ie6...

谢谢

my website does not work on firefox (firefox 4 or 7), nothing appears, even not the alternative content

and with IE9, the problem is the content is compacted at the top of the page... (but it works on IE6 !)

and the html is :

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

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? the website works on chrome, safari, ie6...

thanks

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

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

发布评论

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

评论(2

沙与沫 2024-12-18 08:54:49

既然您正在使用 swfObject 为什么不使用它来进行实际的嵌入
您会发现以下代码示例更加符合浏览器要求。

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

[编辑]
试试这个

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

Since you are using swfObject why are you not using it to do your actual embedding
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>
静若繁花 2024-12-18 08:54:49

我最近也遇到了同样的问题,我将高度和宽度设置为100%,而firefox不会显示IE9会将swf压缩到页面顶部高度:100px之类的。我用 JavaScript 修复了这个问题,实际上是 jQuery(只是因为它可用):

本质上 FF 在调整大小时不喜欢 % 值,而 IE9 有一个不同的问题。如果您添加静态值,就不会有问题。但我们不想要静态值,不是吗?

不管怎样,我通过告诉 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>

我使用 $(window).width() 获取屏幕的宽度,然后使用 Math.round(($(window).width()*11)/24) code> 因为我的电影的比例是 24X11。

这又是我的 jQ 解决方案,因为它可用,您可以使用 screen.width 来获取它。您可能必须将所有内容压缩为一行,尽管我只是将其间隔开,以便您可以看到发生了什么。

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. I fixed it with JavaScript, actually jQuery (simply because it was available):

Essentially FF doesn't like % values when you size things, and IE9 has a different problem. 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.

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

Again this was my jQ solution because it was available, you could use screen.width to get it. You might have to condense everything to one line though I just spaced it so you could see what's going on.

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