When cookies are accepted, YouTube iframe SRC switched to “null”
-
Hi! Thanks for the plugin, Your work is much appreciated ??
We noticed a weird behaviour with our YouTube embeds: The iframe URL is loaded correctly as we pass it in the template file, but apparently Complianz changes it to a “null” once cookies are accepted.
If not accepted, no placeholder is shown, although it is enabled in the backend.
Before last changes, we had the same problem, but the iframe’s SRC was pointing at youtube-nocookies and we could play the video if cookies weren’t accepted. But as soon as “Agree” was clicked, the SRC would switch to a null value again.
We are passing the URL using an ACF field:
<?php foreach ($videos as $video) { $src = 'https://www.youtube.com/embed/' . $video['id']; echo '<div style="font-size: 12px;">ID: ' . $src . '</div>'; ?> <li class="v-single-artist__videos-list-item"> <iframe src=<?= $src ?>" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen data-category="marketing" <?php // Complianz ?> ></iframe> </li> <?php }; ?>
Are we doing something wrong?
Massive thanks in advance.
The page I need help with: [log in to see the link]
- The topic ‘When cookies are accepted, YouTube iframe SRC switched to “null”’ is closed to new replies.