wall-of-consent
v0.0.1
Published
[![npm version](https://badge.fury.io/js/wall-of-consent.svg)](https://badge.fury.io/js/wall-of-consent)
Downloads
4
Readme
Wall-Of-Consent
Ask user for consent before embedding scripts from third parties.
This package contains the custom element <wall-of-consent>
which expects the following structure:
<wall-of-consent>
<template>
Third party code goes here
</template>
<input type="checkbox"> Do you agree ...?
</wall-of-consent>
Usage
Just install this npm and import the code into your JavaScript:
npm install wall-of-consent --save-dev
import "wall-of-consent";
Example
<wall-of-consent>
<template>
<blockquote class="twitter-tweet" data-conversation="none" data-lang="en" data-dnt="true"><p lang="en" dir="ltr">Doge spelled backwards is Egod</p>— Elon Musk (@elonmusk) <a href="https://twitter.com/elonmusk/status/1368058884837928970?ref_src=twsrc%5Etfw">March 6, 2021</a></blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</template>
<p data-hide-if-consent>Would you like to embed code and cookies from twitter directly into this page?</p>
<label>
<input type="checkbox" />
Show tweets
</label>
</wall-of-consent>