से यूट्यूब जावास्क्रिप्ट/आईफ्रेम एपीआई का उपयोग करके 'DOMWindow' त्रुटि पर 'निष्पादन में विफल' पोस्ट मेसेज 'को हल करने के लिए कैसे करें मैं अन्य चीज़ों के बीच एक वीडियो के अलग-अलग समय की तलाश करने की कोशिश कर रहा हूं।यूट्यूब एम्बेड
मैं इस के लिए एक डेमो नीचे छीन लिया गया है:
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided
('https://www.youtube.com') does not match the recipient window's origin
('http://jsbin.com').
मैं शुरू करने के लिए हल करने के लिए इस की जरूरत है: http://jsbin.com/yuliponu
var player;
window.onYouTubeIframeAPIReady = function() {
var iframe = document.createElement("iframe");
iframe.width = 400;
iframe.height = 300;
iframe.id = "youtubeIframe";
iframe.src = "https://www.youtube.com/embed/yta1WRuiupk?autoplay=1&enablejsapi=1&origin="+encodeURIComponent(window.location.protocol+"//"+document.domain)+"&playsinline=1&rel=0";
iframe.setAttribute('frameborder', '0');
iframe.setAttribute('allowFullScreen', '');
document.getElementById("video").appendChild(iframe);
player = new YT.Player('youtubeIframe');
};
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
आप कंसोल में एक बार देख ले, तो आपको यह त्रुटि देखेंगे जावास्क्रिप्ट एपीआई का उपयोग करना, लेकिन मुझे यकीन नहीं है कि इसे कैसे ठीक किया जाए।
अद्यतन:
मैं के बाद से अपने कंप्यूटर को पुनः आरंभ किया है, और त्रुटि नहीं होती है। अगर मैं फिर से त्रुटि देखता हूं तो मैं अपडेट करूंगा।