-1

Possible Duplicate:
How do you execute a Javascript function when the page has fully rendered?

As I know, the onload() event can be used to do something when the page is fully loaded. Is there a similar event for indicating that the browser has fully finished rendering the page?

Community
  • 1
  • 1
lang2
  • 9,253
  • 14
  • 67
  • 110
  • 2
    What do you mean by "rendering the page"? Do you mean when the images are done loading? Do you mean when the DOM is loaded? –  Jul 25 '12 at 16:18
  • For what do you need the rendering time? – Bergi Jul 25 '12 at 16:18
  • 2
    See http://stackoverflow.com/questions/799981/document-ready-equivalent-without-jquery – j08691 Jul 25 '12 at 16:18
  • 2
    Answered here http://stackoverflow.com/questions/939538/how-do-you-execute-a-javascript-function-when-the-page-has-fully-rendered Marked duplicate. Use the search man. – idrumgood Jul 25 '12 at 16:19

2 Answers2

0

The event is called DOMReady but it's not readily available in every browser, so the jquery ready wrapper can help.

Aadaam
  • 3,049
  • 1
  • 12
  • 9
-1

...indicating that the browser has fully finished rendering the page?

(My emphasis.) That's the load event on window. Yes, it waits for all images, but you have to wait for all images to "fully finish" rendering the page.

If you want something earlier, when the page is not "fully finished rendering," there isn't anything well-supported cross-browser. The usual recommendation is to put your script at the very bottom of the page. It can then access any DOM element defined above it (e.g., all of them). But I can't guarantee the page is fully rendered at that point (painted on-screen), just that the DOM elements exist and can be interacted with. (This is why libraries use a variety of techniques depending on what will work on each browser.)

References:

T.J. Crowder
  • 879,024
  • 165
  • 1,615
  • 1,639