nk-o / jarallax

Parallax scrolling for modern browsers
https://jarallax.nkdev.info
MIT License
1.39k stars 214 forks source link

YouTube integration throws XMLHttpRequest CORS policy errors #184

Open RickR2H opened 3 years ago

RickR2H commented 3 years ago

The YouTube video is loaded but there are console errors.

Issue description:

Chrome Console Errors:

Access to XMLHttpRequest at 'https://googleads.g.doubleclick.net/pagead/id' from origin 'https://www.youtube-nocookie.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Failed to load resource: net::ERR_FAILED

Version used:

Version : 1.12.5 via CDN

Code to reproduce the issue (HTML blocks + JavaScript initialization)

This is the default example integration via data-attributes

<!-- Background YouTube Parallax -->
<div class="jarallax" data-jarallax-video="https://www.youtube.com/watch?v=ab0TSkLe-E0">
    Your content here...
</div>

I hope you can help...

nk-o commented 3 years ago

Hey. We changed the Youtube URL to youtube-nocookie.com for GDPR compliance. And looks like it is conflicting with google ads.

I think you will need to use the 1.12.4 Jarallax version to prevent such errors.

RickR2H commented 3 years ago

@nk-o Thanks for the feedback! I'll try that first.

plusorminus8 commented 3 years ago

I'm seeing the same error and have Jarallax version 1.0.1 on my site (which I know should be upgraded; it came with my Bootstrap theme).

It also seems to happen for the YouTube section of the Jarallax demo site: https://free.nkdev.info/jarallax/

Any ideas on how to fix?

joeybab3 commented 3 years ago

Can confirm I'm also seeing this on 1.12.2 and 1.12.4

joeybab3 commented 3 years ago

For context, it appears youtube has broken a lot of embed codes so that might be related?

kbrmani commented 10 months ago

I am facing same problem but my website on Wordpress actually when, I am using Youtube video in my post then the error Show on Google search console "Access to XMLHttpRequest at 'https://googleads.g.doubleclick.net/pagead/id' from origin 'https://www.youtube.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource."