2

I opened this file on Firefox it works fine, but on IE11 and IE8 it didn't fire the event: onReady it works fine on webserver thou, for both Firefox and IE.

<!DOCTYPE html>
<html>
<head>
<!-- // this is needed to force our embedded browser to run in EDGE mode -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
  <body>
    <!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
    <div id="player"></div>

    <script>

      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;
      function onYouTubeIframeAPIReady() {
        player = new YT.Player('player', {
          height: '390',
          width: '640',
          videoId: '0Bmhjf0rKe8',
          events: {
            'onReady': onPlayerReady
          }
        });

        }

      function onPlayerReady(event) {
        alert("onReady!");//didn't work on IE localfile
        event.target.playVideo();
      }
    </script>
  </body>
</html>

Are there any work around for this ?

Area50plus1
  • 111
  • 2
  • 7

0 Answers0