Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/390.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript youtube iframe api事件未在IE上触发_Javascript_Html_Iframe_Youtube Api_Youtube Javascript Api - Fatal编程技术网

Javascript youtube iframe api事件未在IE上触发

Javascript youtube iframe api事件未在IE上触发,javascript,html,iframe,youtube-api,youtube-javascript-api,Javascript,Html,Iframe,Youtube Api,Youtube Javascript Api,java脚本代码: var tag = document.createElement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag)

java脚本代码:

     var tag = document.createElement('script');

      tag.src = "https://www.youtube.com/iframe_api";
      var firstScriptTag = document.getElementsByTagName('script')[0];
      firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

  var player;

window.onYouTubeIframeAPIReady=function() {
      player = new YT.Player('video', {

          events: {
            'onReady': onPlayerReady,
            'onStateChange': onPlayerStateChange

          }
        });




}

  function onPlayerReady(event) {

    alert("onPlayerReady");

  }
   function onPlayerStateChange(event) {

    alert("stateChanged");

  }
对于html中的iframe,我写了这个

<iframe id="video" width="560" height="315" src="https://www.youtube.com/embed/CHE_oNJAOaU?enablejsapi=1&autohide=1&autoplay=1&controls=0&showinfo=0&playerapiid=ytplayer" frameborder="0" allowfullscreen></iframe>

当我在google chrome或safari上运行此代码时,代码运行得很好,我收到了警告消息,但当我在IE上尝试时,什么都没有发生(使用IE11) 我希望你们有我两天来一直在寻找的解决方案