Skip to content

Instantly share code, notes, and snippets.

@residuum
Created February 9, 2010 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save residuum/299793 to your computer and use it in GitHub Desktop.
Save residuum/299793 to your computer and use it in GitHub Desktop.
if (window.addEventListener) { // DOM
window.addEventListener('load', function () {
FUNCTION();
}, false);
} else if (window.attachEvent) { // IE
window.attachEvent('onload', function () {
FUNCTION();
});
} else if (typeof window.onload === 'undefined') { // other
window.onload = function () {
FUNCTION();
};
} else {
window.onload = window.onload && function () {
FUNCTION();
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment