Closed GoogleCodeExporter closed 9 years ago
Can you show an exact example of where this happens?
As far as you can tell, did this also happen with previous versions of
SWFObject?
Original comment by bobbyvandersluis
on 22 Jun 2009 at 9:03
Hi Bobby, thanks for the quick reply.
As far as I can tell, the issue I’m describing above is not a bug with
SWFObject.
It’s more of a feature request.
As I understand, SWFObject (in 'dynamic publishing' mode) waits for the Web
browser’s
'DOM loaded' event before doing its thing (executing the createSWF() method).
This is
the expected behavior and works just fine.
However, since we started displaying ads on our website (www.telequebec.tv),
the Web
browser’s 'DOM loaded' event takes a lot longer to fire (since the Web
browser must
now wait until all the JavaScript files for the ads have been downloaded and
parsed
before it can fire that event). And most ad servers are dead slow…
I would like to know if SWFObject could be configured to do its thing
(executing the
createSWF() method) before the Web browser has fired its 'DOM loaded' event.
That
way, my Flash files would not have to wait until the JavaScript for the ads
have been
loaded before they can be displayed by SWFObject.
Maybe something like this…
<div id="myFlashFile"></div>
<script type="text/javascript">
swfObject.createSWFNowEvenIfDOMNotLoadedYet();
</script>
I’m not sure but didn’t FlashObject 1.5 work that way? Did FlashObject 1.5
use to
wait for the Web browser’s 'DOM loaded' event to do its thing?
I understand that manipulating the DOM before it has fully loaded might not be
completely safe in all cases. But in most cases (as in my example above), we
can
assume that the DOM node that needs to be replaced by a .swf file will not be
modified later on by some JavaScript so we could theoretically modify it right
after
it has been declared in the HTML and not have to wait until the 'DOM loaded'
event is
fired.
Original comment by david_be...@yahoo.com
on 22 Jun 2009 at 2:31
You cannot dynamically add elements to a Web page before the DOM has loaded
(read:
the structure of a Web page has loaded, excluding images, SWFs, an other
external
assets). So what you request is not really possible.
Also, I think that the problem you are encountering is that browsers generally
refuse
to do any further rendering of a Web page until they have received a requested
Javascript file, in your case a script from a slow ad server that is added
in-page.
One solution to solve this is to use iframes instead, so the adds and their
scripts
will be loaded independently of the main page. Only restriction you have here
is that
iframes have a fixed width/height.
Furthermore, if you use static publishing (regular markup) your SWF will start
loading as fast as possible (milliseconds before the DOMContentLoaded kicks in
and
dynamic elements are inserted), so that will give the fastest performance
loading-wise.
Original comment by bobbyvandersluis
on 23 Jun 2009 at 9:43
Original issue reported on code.google.com by
david_be...@yahoo.com
on 20 Jun 2009 at 6:24