Say you wanted a Greasemonkey script to be compatible with Safari and Chrome.
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.
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.
How to code this?
@NV
Thanks NV, do you know if that script is also Google Chrome compatible?
Will the code
(function(){
// Code here run after 'load' event in all browsers.
})();
also run on DOM ready in Google Chrome?