postpone embed loading until user gives consent
npm install embed-consent
<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()