Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to execute 'postMessage' on 'DOMWindow' #51

Open
Demy opened this issue Aug 6, 2018 · 5 comments
Open

Failed to execute 'postMessage' on 'DOMWindow' #51

Demy opened this issue Aug 6, 2018 · 5 comments

Comments

@Demy
Copy link

Demy commented Aug 6, 2018

Embedding video to the page causes this error in the console:
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://www.youtube.com') does not match the recipient window's origin (*host name*)

"Angular YouTube Embed" has the same problem.

@SDVII
Copy link

SDVII commented Sep 12, 2018

I think adding a host to the YouTube Player object could fix the issue:

  this$1.player = new YouTube.Player(this$1.elementId, {
    ...
    host: 'https://www.youtube.com',
    ...
  }

@Anploe
Copy link

Anploe commented Oct 2, 2018

i yust had the same issue and at least in my local enviroment setting
:player-vars="{origin:'http://mydomain.local'}"
seems to solve the issue

@renetik
Copy link

renetik commented May 21, 2019

<template>
  <iframe :height="height" :src="youtubeUrl()" :width="width"/>
</template>

<script lang="ts">
  import { Component, Prop, Vue } from 'vue-property-decorator'

  @Component
  export default class CSYoutubeVideo extends Vue {

    @Prop({ required: true }) videoId!: string
    @Prop({ required: true }) width!: string
    @Prop({ required: true }) height!: string

    youtubeUrl(): string {
      return `https://www.youtube.com/embed/${this.videoId}?modestbranding=1&playsinline=0
      &showinfo=0&enablejsapi=1&origin=${window.location.origin}&widgetid=1`
    }
  }
</script>

@dezignhero
Copy link

for playerVars setting origin: window.location.origin worked for me.

@sioniks
Copy link

sioniks commented Dec 17, 2020

for playerVars setting origin: window.location.origin worked for me.

for me worked to, but window.location.origin i set like String

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants