I am using youtube iframe api to use the youtube video player in my webpage. It works well in the browsers and all the tracking features working well. But my problem is I am getting an error message in the google chrome browser "Unable to post message to https://www.youtube.com. Recipient has origin https://www.mydomain.com". Here is the code.
<script src="http://www.youtube.com/player_api"></script>
<iframe width="450" height="253" src="https://www.youtube.com/embed/EpOvTyklFxc?rel=0" frameborder="0" allowfullscreen id="yes"></iframe>
<script language="javascript">
var player;
function onYouTubePlayerAPIReady() {
player = new YT.Player('yes', {
events: {
'onReady': function(){ alert("yes!"); }
}
});
}
</script>
Please help me to resolve this.
asked Oct 11, 2013 at 13:52
Vinayak Infotech
1791 gold badge2 silver badges11 bronze badges
1 Answer 1
Add the origin parameter: specify your domain as the origin parameter value. See: https://developers.google.com/youtube/player_parameters#origin
answered Oct 11, 2013 at 14:26
Als
1,4251 gold badge11 silver badges5 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-js