Add option to disable async loading

Created on 22 March 2022, about 3 years ago
Updated 22 March 2023, about 2 years ago

When using this module, for dynamically loading embeds (Such as Vimeo or Soundcloud), based on consent, the `async` tag causes major issues.

From what I can see in the browser log, it's due to the DEFAULT "Content Blocker" feature of Safari.
If I turn off Content Blocker, it works every time.

If the content blocker is on, it works ROUGHLY 33% of the time, when loading the page.

I contacted Cookiebot, and they told me this:

It looks like it's caused by a timing issue, that apparently only happens in Safari. When I am unable to load the placeholder

, I get the following error message that seems to be related to a variable that doesn't yet have any value:
You can either remove the 'async' part of the Cookiebot script, which will force your other scripts to wait for the Cookiebot script to be fully loaded and thereby have the 'Cookiebot' Javascript object loaded with data or you can set up an event listener on your function that dynamically loads your Vimeo videos, to make sure that process doesn't start until Cookiebot is fully loaded.
You can find an overview of the events pushed by the Cookiebot script in our developer documentation: https://www.cookiebot.com/en/developer/.

I've tested removing the 'async' part of your Cookiebot script in a local override in Safari, and I am unable to provoke the issue when loading the Cookiebot script synchronously.

He was completely right - when I remove the `async` that is added through this module, it works every single time in Safari.

Proposed solution

Provide an extra setting to allow users to optionally disable the async loading of cookiebot when this causes issues on your project.

Things to do

Provide a patch/Issue fork

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇩🇰Denmark ras-ben Copenhagen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024