window.onload is unreliable