Javascript only works when with alerts
alert, javascript
Solution
you are probably invoking the code before the page loads. With the alert, js execution stops, allowing the page to load. If this is correct, you need to look into the `window.onload` callback or possibly `document.ready`
window.onload = function(){
// load the vid here
}
Problem
The following code loads a youtube vidéo in a player. If I remove the two "alert", it doesn't work anymore... ``` ytplayer = document.getElementById("ytPlayer"); alert('ok'); if (ytplayer) { alert('ok'); loadVideo(url, start); } ``` Can someone help me?