changed window.onload to window.addEventListener to prevent window.onload being overridden