I've been battling with the youtube iframe api for quite some time now. Somehow the method onYouTubeIframeAPIReady is not always triggered. From the symptoms it seems a loading problem. No errors are shown in the inspector. Here is my code: HTML <div id="player"></div> <script> videoId = 'someVideoId'; var tag = document.createElement('script'); tag.src = "//www.youtube.com/iframe_api"; var firstS