title: Possible actions before document is ready
body: <h2>Problem</h2>
  
  <p>I wrote a script for informing user that the page is loading slowly (say, it is because of slow internet connection). The script is put first in the <code>&lt;head&gt;&lt;/head&gt;</code> and is quite simple:</p>
  
  <pre><code>var GLOBAL_TIMEOUT = setInterval(function () {      
      alert("The Internet connection is slow. Please continue waiting.");
  }, 30000);
  
  //clear that interval somewhere else when document is ready
  $(function () {
      clearInterval(GLOBAL_TIMEOUT);
  });
  </code></pre>
  
  <h2>Question</h2>
  
  <p>In the current example information is simply alerted. Is there any other possible way to inform user about slow loading of the page (particularly when some <code>js</code> or <code>css</code> file in the head is really big and takes some time to load)? I've tried manipulating the DOM (which is, in my opinion, is not right thing to do before document is ready) and <code>document.body</code> resulted in <code>null</code>. </p>
  
  <h2>Additional</h2>
  
  <p>The solution with setting an interval is from <a href="https://stackoverflow.com/a/9011781/2120289">here</a>. Any other ideas of how to do that are greatly appreciated.</p>