using window.onload is causing the script to never execute. is there a reason it has to be used? calling the script with defer should be enough to make sure it runs at the proper time.