JS: add onload event on window