mahnouel / EmbedConsent

postpone embed loading until user gives consent

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Embed Consent

postpone embed loading until user gives consent

Installation

npm install embed-consent

npm

Usage

<article class="js-embed" data-embed-src="https://www.youtube.com/embed/flLc6LmAG6c">
  Please confirm you want to load this YouTube video:
  <button class="js-embed__opener">Okay</button>
</article>

The data-embed-id attribute can be used to set a cookie when the user gives consent. After that the embed permission request won't show itself for the next 90 days.

import EmbedConsent from 'embed-consent'

const embed = new EmbedConsent()
embed.enable()

About

postpone embed loading until user gives consent


Languages

Language:JavaScript 100.0%