onDocLoad

Usually when you want to do something when the page is done loading, you set the window.onload handler somehow. The problem with that is that window.onload will wait for all dependents, such as images and objects, to load before it fires, which may take a long time. If you want a responsive application, you probably need scripts to fire as soon as the page data itself is loaded. That's what onDocLoad does:

<script>
widget.onDocLoad(handler)
</script>

handler is a function that gets called as soon as the page is loaded.

The following example sends you an alert when the page is done loading:

<script>
function iAmLoaded() {
   alert("Hi, I'm loaded!");
}

widget.onDocLoad(iAmLoaded);
</script>


Page Information

  • 1 year ago [history]
  • View page source
  • You're not logged in
  • No tags yet learn more

Wiki Information

Recent PBwiki Blog Posts