jarallax icon indicating copy to clipboard operation
jarallax copied to clipboard

YouTube integration throws XMLHttpRequest CORS policy errors

Open RickR2H opened this issue 3 years ago • 6 comments

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...

RickR2H avatar Dec 16 '20 11:12 RickR2H

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.

nk-o avatar Dec 18 '20 17:12 nk-o

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

RickR2H avatar Dec 24 '20 15:12 RickR2H

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?

plusorminus8 avatar Jan 22 '21 17:01 plusorminus8

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

joeybab3 avatar Jan 29 '21 21:01 joeybab3

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

joeybab3 avatar Feb 11 '21 01:02 joeybab3

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."

kbrmani avatar Nov 14 '23 13:11 kbrmani