0

Actual behavior:

When opening a page the cookie banner is displayed. When the cookies are accepted everything works as intended. When the only necessary cookies are accepted the lazy loading of pictures doesnt work anymore. After reloading the page everything works as intended. Also, everything works as intended when the necessary cookies are accepted fast.

Expected behavior:

Even when only the necessary cookies are accepted the lazy loading of images still works.

The lazy loading is implemented in a Vue.js component. When a image is intersecting the viewport a method is triggered that adds a event handler for the 'load' event of the image that just sets a property which controls if a loading spinner is displayed.

This is the method. So nothing special.

loadImage() {
            const image = this.$el.querySelector('img');

            if (image) {
                image.addEventListener('load', () => {
                    this.isLoaded = true;
                });
                image.addEventListener('error', () => {
                    this.hasError = true;
                });
                this.isIntersected = true;
            }
        }

It seems that the load event handler never gets triggered when only the necessary cookies are accepted. Anyone had a problem like this and has a solution?

Danny.404
  • 71
  • 1
  • 7
  • "everything works as intended when the necessary cookies are accepted fast" what you mean "fast"? if you don't do it fast, lazy loading fails? – GrafiCode Aug 11 '22 at 11:40
  • Yep, if you click in like a second everything works. If you wait more than 2 seconds and only accept the necessary cookies lazy loading wont work anymore. – Danny.404 Aug 11 '22 at 12:07
  • I don't know cookiebot very well, but I think you can solve the "click fast" problem allowing cookiebot to reload the page after the user consents. – GrafiCode Aug 11 '22 at 12:10
  • For the overall problem, I think cookiebot is removing scripts from your page. That's how those cookie-blocking services work, if the user denies the use of cookies or the user doesn't make a choice at all, cookiebot tends to block everything. Please see this to instruct the scanner to allow certain scripts without consent: https://support.cookiebot.com/hc/en-us/articles/360009063660-Disable-automatic-cookie-blocking-for-a-specific-script – GrafiCode Aug 11 '22 at 12:15

1 Answers1

1

I actually got a response from the Cookiebot Support. They also said that you should just trigger a reload of the page, when the cookies get declined.

Danny.404
  • 71
  • 1
  • 7