I've been using the following trick successfully for a few months now.
It _seems_ to work fine cross-browser and cross platform.
<script type="text/javascript">
signal(window,'ondomload');
</script>
</body>
</html>
But based on the recent thread about implementing ondomload, I assume
that there must be cases when a simple signal at the end of the dom
isn't enough.
Can anyone give me a quick earful about why the above isn't the best
way to do it?
--
Chris Snyder
http://chxo.com/
http://webkit.org/blog/166/optimizing-page-loading-in-web-browser/
And a small extract of the most relevant section:
---
Problems start when a document contains references to external
scripts. Any script can call document.write(). Parsing can't proceed
before the script is fully loaded and executed and any
document.write() output has been inserted into the document text.
Since parsing is not proceeding while the script is being loaded no
further requests for other resources are made either. This quickly
leads to a situation where the script is the only resource loading and
connection parallelism does not get exploited at all. A series of
script tags essentially loads serially, hugely amplifying the effect
of latency.
---
So, in my understanding, putting a <script> tag at the very end of the
HTML text on the page should be nearly identical to actually waiting
for the onDOMLoad event. All the document text should have been parsed
already and be available in the DOM tree.
One of the many issues with "onload" is also the latency involved in
loading images and CSS files, which actually adds up to quite some
time (as most browsers only request 2 objects simultanously per web
site).
/Per
-bob
/Per
On Thu, May 8, 2008 at 11:02 PM, David Janes <david...@blogmatrix.com> wrote:
> And just to jump in here -- surely there's a "done" solution for this that
> we like, can we not just port something from another toolkit?
> Regards, etc...
> --
> David Janes
> Founder, BlogMatrix
> http://www.blogmatrix.com
> http://www.onaswarm.com
>
>
>