0

私はこのエラーをデバッグしようとしています、そしていくつかの提案を使うことができます:

TypeError: 'null' is not an object (evaluating 'a.a.contentWindow.postMessage')
www-widgetapi-vflsofjNm.js:19

現在、これはSafariバージョン6.0.2(7536.26.17)で発生しています。基本的なプロセスは次のとおりです。

コンテナのあるページがあります-jQueryの$.get()を使用してコンテンツをこのコンテナにロードします:

<div id="container">
<iframe id="player1"><iframe id="player2"><iframe id="player3">
</div>

iFrame APIを使用して、コンテナー内のすべてのビデオを停止できます。

var player1 = new YT.Player('player1');
console.dir(player1);
player1.stopVideo();
-> no error, video stops

次に、別のコンテンツを新しいコンテナにロードします。

<div id="container">
<iframe><iframe><iframe>
</div>
<div id="anothercontainer"></div>

iframeを保持しているコンテナを削除します。

<div id="anothercontainer"></div>

次に、iframe(同じID)を再度追加し、他のコンテナーを削除します。

<div id="container">
<iframe id="player1"><iframe id="player2"><iframe id="player3">
</div>

新しいiframeを使用してiframeをコンテナにロードした後(2回目)、YTJSを再度呼び出します。

var player1 = new YT.Player('player1');
console.dir(player1);
player1.stopVideo();
-> no error, video stops

console.dir(player1)はオブジェクトを表示しますが、player1.stopVideo()を呼び出すと、上記のエラーが発生します。何か案は?

4

0 に答える 0