"OnLoad" executed before page loaded? [External Link]
I was working with iFrames and wrote some code making sure that the frame resize as soon as the page is loaded, but I came across an interesting bug. 3 of my pages works perfectly fine when viewed, but upon returning to the home page, it doesn't resize when it's loaded. I set up an alert to tell me when the page is successfully loaded, and see that the alert comes before the /home.html is loaded. I assume that the home.html's data is loading fast and javascript throws the alert before the page is actually loaded. Here's my website I'm working on: https://preview.c9users.io/zalimitless/guesthouse/index.htm To see the bug click on any other page, then click on home again. Can someone tell me how I can get around this bug? Javascript code: https://code.sololearn.com/WYRJH3x5y1dC (Please don't judge, the page is still under construction)