Flash loads twice workaround?
Asked Answered
O

3

7

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!

Oogonium answered 1/2, 2009 at 1:2 Comment(0)
H
3
<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">
    <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>             
Hormone answered 1/2, 2009 at 1:15 Comment(2)
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...Oogonium
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.Hormone
K
1

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

Kumkumagai answered 3/11, 2009 at 20:33 Comment(1)
it didn't fix the problem for meSlat
C
0

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.

Carranza answered 25/8, 2010 at 16:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.