4
votes

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.

1

1 Answers

2
votes

Add the origin parameter: specify your domain as the origin parameter value. See: https://developers.google.com/youtube/player_parameters#origin