<iframe> Click-to-Play

Get consent from website visitors to load iframes.

Some <iframe>s might save cookies or do other kinds of tracking. This isn't allowed under GDPR law without prior consent from the user. A “click-to-play” solution helps with this situation.

Installation with npm

npm install @mvsde/iframe-click-to-play

Installation with a CDN

All browsers

Use this for the widest browser support.

<script src="https://unpkg.com/@mvsde/iframe-click-to-play" defer></script>

Modern browsers

Use this to support only modern browsers which understand ES Modules ↗.

<script src="https://unpkg.com/@mvsde/iframe-click-to-play/dist/iframe-click-to-play.esm.js" type="module"></script>


Take a look at the repository readme ↗ or the source code for the demos: