4

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

1 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.