Встроенное видео YouTube не останавливается в Chrome и IE

Несколько тем на эту тему но у меня нет ответов.

Встраивание видео с YouTube в оверлейный div:

   <div id="blanket" style="display:none;">
     </div>
        <div id="popUpDiv" style="display:none;">
        <a href="#" onclick="popup('popUpDiv')">Close</a>     
        <iframe width="480" height="390" src="https://www.youtube.com/embed/G5AuItKv?rel=0&autoplay=1" frameborder="0" allowfullscreen></iframe>                                       
        </div>

В firefox, когда я закрываю окно, видео останавливается, но не в Chrome или Internet Explorer.

Есть ли какой-нибудь простой JavaScript, который я могу использовать чтобы остановить его, когда пользователь нажимает кнопку «Закрыть»?

TIA

Edit:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<a href="#" onclick="javascript:ytplayer.stop()">Close</a>

 <iframe width="480" height="390" src="http://www.youtube.com/e/PE1il5znICA?enablejsapi=1&version=3&playerapiid=ytplayer" frameborder="0"  allowfullscreen></iframe>


 <script type="text/javascript">
function onYouTubePlayerReady(playerId) {
    ytplayer = document.getElementById("ytplayer");
}

function stop() {
  if (ytplayer) {
    ytplayer.stopVideo();
  }
}
</script>
</body>
</html>
5
задан James MV 11 August 2011 в 20:24
поделиться