title: Greasemonkey script compatibility with Firefox, Safari, Opera and chrome (onload event)
body: <p>Say you wanted a <a href="http://en.wikipedia.org/wiki/Greasemonkey" rel="nofollow noreferrer">Greasemonkey</a> script to be compatible with Safari and Chrome.</p>
  
  <p>Whereas in Firefox the Greasemonkey scripts only run when the DOM is ready.
  Chrome, Safari and Opera seem to run the Greasemonkey scripts before the DOM is ready.</p>
  
  <p>So what I am looking for is a solution that will only run a listener on the page, waiting for the DOM loaded/ready event, and on receiving that event, then run the rest of the script. If the browser they are using is Chrome, Safari or Opera. If they are using Firefox, just run the script straight away and not bother with the event listener.</p>
  
  <p>How to code this?</p>
  
  <p><strong>@NV</strong></p>
  
  <p>Thanks NV, do you know if that script is also Google Chrome compatible?</p>
  
  <p>Will the code</p>
  
  <pre><code>(function(){
  
      // Code here run after 'load' event in all browsers.
  
  })();
  </code></pre>
  
  <p>also run on DOM ready in Google Chrome?</p>