Wait until the page is loaded before setInterval