Closed GoogleCodeExporter closed 9 years ago
Well, that's not how SWFObject works. It contains a DOM independent and a DOM
dependent part, so when you define all your scripts in the header of your Web
page it
immediately executes the DOM independent code, and adds the DOM dependent part
as
soon as the DOM of a page is available, via the DomContentLoaded event or a
simulation of it if the browser doesn't support it.
The link you refer to is an old workaround that dates before the time of the
DomContentLoaded event and a bad practice IMO. It also performs worse, because
the
DOM independent part is only executed at the end of the page. Furthermore just
Google
for "unobtrusive JavaScript" to see what the advantages of this approach is.
So either use SWFObject as intended or - worse - include your scripts at the
top of
your body before the actual object elements that embed your Flash content.
Original comment by bobbyvandersluis
on 2 Jul 2009 at 3:40
[deleted comment]
[deleted comment]
It's my understanding that Unobtrusive JavaScript is a technique to promote
separation of concerns (separation of behavior from presentation), not requiring
where a <script /> tag must reside. Placing your JavaScript code in a file
promotes
SoC, but requiring the <script /> tag to be placed in the <head /> of a document
doesn't really ensure SoC, IMO :)
My main concern with this implementation is that this requires a workaround for
ASP.NET AJAX developers when using an ASP.NET ScriptManager control. The
ScriptManager control manages script file registrations on the Page, as well as
any
other control using a ScriptManagerProxy. Script registrations are then placed
before
any content on the page (immediately following the <body> tag), but yet they are
not in the <head /> tag. That being said, ASP.NET AJAX developers using the
ScriptManager control (which nearly all do) cannot use SwfObject for static
publishing with this implementation. I will modify my GdnSwfObject server
control to
fix this issue, but I wanted to bring this limitation to your attention.
I'd also like to note that I've only been able to reproduce the issue using
Firefox
3+ and static publishing. With that said, the <script /> reference to
swfobject.js is
placed before the <object /> tag. Thoughts?
Thanks, Bobby!
Original comment by grant.ha...@gmail.com
on 5 Oct 2009 at 9:41
Original issue reported on code.google.com by
lunde...@gmail.com
on 2 Jul 2009 at 10:15