Block YouTube Cookies when lazyloading Thumbnail

If you look closely, you have two img tags:

enter image description here

You have duplicate codes:

  • The code in your globaljs.js loads from youtube.com.

enter image description here

  • The code inside your script tag embed in home loads from www.youtube-nocookie.com

enter image description here

Last Step:

For thumbnails img.youtube-nocookie.com does not work. You were fetching thumbnail from youtube.com all along. Change your thumbnail loading code to:

var source = "https://i1.ytimg.com/vi/"+ youtube[i].dataset.embed +"/sddefault.jpg";

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top