nicolafranchini/VenoBox

Use data-src instead of src?

Closed this issue · 1 comments

Hi

I was hoping there's a way to use data-src instead of src for vimeo videos?

I'm trying to block the vimeo player unless a visitor provides consent to set 3rd party cookies. I'm using a service called Termly, their guide recommends using this code:

The termly docs provide this as an example, this is for a youTube video, but the principle is the same.

Original code

<iframe width="560" height="315" src="https://www.youtube.com/embed/xxxxxxxxx" frameborder="0" allowfullscreen></iframe>

Termly code

<iframe width="560" height="315" data-src="https://www.youtube.com/embed/xxxxxxxxx" data-categories="advertising" frameborder="0" allowfullscreen></iframe>

The only difference is src has been replaced with data-src and an additional attribute has been added data-categories="advertising"

I've tried to modify venobox,js running version 1.8.5

I figured I could change this

content.html(
            '<iframe class="venoframe vbvid" webkitallowfullscreen mozallowfullscreen allowfullscreen allow="autoplay" frameborder="0" src="' +
              player +
              videoObj.id +
              queryvars +
              '"></iframe>'
          );

to

content.html(
            '<iframe class="venoframe vbvid" webkitallowfullscreen mozallowfullscreen allowfullscreen allow="autoplay" frameborder="0" data-src="' +
              player +
              videoObj.id +
              queryvars +
              '"  data-categories="advertising" ></iframe>'
          );

But it doesn't work?

Is this possible?

I don't know Termly, I'm sorry, your approach seems ok.