title: How to check if DOM is ready without a framework?
body: <p>The question is so like a zillion others here and on the web - How to check if DOM has loaded in Javascript? But here's the catch:</p>
  
  <ul>
  <li>Without using a framework like jQuery etc;</li>
  <li>Without knowing if your script has been loaded via a statically placed <code>&lt;script&gt;</code> tag or via some other Javascript much later after the DOM has already loaded.</li>
  </ul>
  
  <p>Can this be done more or less reliably and with cross-browser compatibility?</p>
  
  <p><strong>Added:</strong> Let me clarify: I'm writing a standalone .JS file which can be included in arbitrary webpages. I want to execute code <strong>AFTER</strong> the DOM has been loaded. But I don't know <strong>HOW</strong> my script will be included. It could be by placing a <code>&lt;script&gt;</code> tag (in which case the traditional <code>onload</code> or DOM-readiness solutions will work); or it could be loaded via AJAX or some other means, much later after the DOM is already loaded (so the previously mentioned solutions will never fire). </p>