Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

Console errors when embedding YouTube videos with both `loading="lazy"` and `enablejsapi=1`

$
0
0

When embedding YouTube videos with both loading="lazy" and enablejsapi=1 I'm getting this console error:Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://www.youtube.com') does not match the recipient window's origin

I'm setting both origin and widget_referrer as my site's domain, so I can't figure out why the provided origin is said to be https://www.youtube.com.

There are a couple of Stack Overflow questions regarding it (for example Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('<URL>') does not match the recipient window's origin ('<URL>')), but it seems the only purposed solution (at least in the scope of embedding with oEmbed) is to disable lazy loading. It does make the console errors disappear, but both lazy loading and analytics tracking (using enablejsapi) are essential functionalities - there must be a way to have them both enabled. I feel like solutions such as saving part of the code locally aren't sustainable.


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>