views:

1297

answers:

3

While investigating a reported problem with my site loading slowly, I came across an issue where I noticed (via firebug) that my flash file was loading twice.

After a bit of investigation I tracked it down to a firefox bug combined with the usage of SWFObject 2.0.

Now, I noticed on the thread that someone mentioned that you can workaround the problem by:

FYI, if you're a webpage developer then an easy workaround to get your page working with FF3 is to delay accessing any plugins until after your page has fully loaded. An easy way to do this is to schedule your plugin scripting code to run after all pending browser events using window.setTimeout with a timeout of zero.

Honestly, I have no clue what they're saying and am hoping someone can give me a code example that will work.

Do you know of a way to make this work and what the code would look like? Any help would be immensely appreciated!

+2  A: 
<script>
  function loadswf()
  {
     swfobject.registerObject("myobj", "9.0.0");
  }
  function init() 
  {
     window.setTimeout("loadswf()", 0);
  }
</script>
<body onload="init()">

 <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="778" height="198" id="myobj">
    <param name="movie" value="style.swf">
    <param NAME=FlashVars VALUE="url={{stylelist}}">
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="style.swf" width="778" height="198">
     <param name="flashvars" value="url={{stylelist}}">
    <!--<![endif]-->

    <a href="http://www.adobe.com/go/getflashplayer"&gt;
    <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
        </a>
    <!--[if !IE]>-->
    </object>
    <!--<![endif]-->
 </object>
Jason Livesay
Well, it's different behavior but this loads the flash and then it disappears totally and I"m left with a white screen in my browser page...
GeoffreyF67
I think we may be doing two different things. Mine is a thought experiment that involves the code above. I am not sure what code you are using exactly -- maybe you could include the complete code?I amended my working code to conform to the setTimeout idea. Also, this might be swfobject 1.
Jason Livesay
+1  A: 

Make sure you're setting the Cache and Expires headers in the response. I had a similar issue with a pdf in an object tag, calling the server twice. Setting the Expires header to be 5 seconds after the current time prevented the second call. HTH

David M
it didn't fix the problem for me
KARASZI István
A: 

This can also be caused by improperly configured CDNs, where they might be not sending the full content or throwing a 206 or other http error.

pyrony