Youtube iFrame Embed throws console errors

I have two youtube iFrame custom code embeds using lazy loading on my website and in my console on chrome it constantly throws these errors: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('<URL>') does not match the recipient window's origin ('<URL>'). (nothing functionality wise is broken) but this console error count will get into the hundreds after a couple minutes on the site.

Has anyone else experienced this?

Hey Austin, a few questions;

  • Are these errors, or warnings? If they’re warnings they may be irrelevant and part of the debug messaging.
  • Are you using a straight-up IFRAME embed or are you using the YouTube js api to initialize the player?
  • Are you trying to use JS in your page to interact with the player?

postMessage is used as a communication vehicle since your website has a different origin than the IFRAME contents. It’s likely complaining that it wasn’t configured with a correct origin for that communication to work.

But again that may not matter at all, if you’re not needing to communicate with it in your custom code.