Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>window.onload</h2> <p><strong>When do they fire?</strong></p> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers.onload" rel="noreferrer">window.onload</a></p> <ul> <li>By default, it is fired when the entire page loads, including its content (images, css, scripts, etc.)</li> <li>In some browsers it now takes over the role of document.onload and fires when the DOM is ready as well.</li> </ul> <p>document.onload</p> <ul> <li>It is called when the DOM is ready which can be prior to images and other external content is loaded.</li> </ul> <p><strong>How well are they supported?</strong></p> <p>window.onload appears to be the most widely supported. In fact, some of the most modern browsers have in a sense replaced document.onload with window.onload. Browser support issues are most likely the reason why many people are starting to use libraries such as <a href="http://jquery.com/" rel="noreferrer">jQuery</a> to handle the checking for the document being ready like so:</p> <pre><code>$(document).ready(function() { /* code here */ }); $(function() { /* code here */ }); </code></pre> <hr> <p>For the purpose of history:</p> <p><strong>window.onload vs body.onload</strong></p> <p>As a note, a similar question was asked on <a href="http://www.codingforums.com/archive/index.php/t-106229.html" rel="noreferrer">codingforums</a> a while back regarding the usage of <code>window.onload</code> over <code>body.onload</code>. The result seemed to be that you should use <strong>window.onload</strong> because it is good to separate your structure from the action.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload