You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I didn't like sending 100KB+ for a simple cookie consent solution so I wrote this. It's currently **3.3kB/br and 3.8kB/gz**, including CSS. It's designed to be as small as possible with an adequate featureset for basic website cookie consent.
6
+
100kB+ seemed too heavy for a cookie popup so I wrote this. It's currently < 4kB gz/btr, including CSS. It's designed to be as small as possible with an adequate featureset for basic website cookie consent.
7
7
8
8
- Stores consent in `localStorage`, exposes in `window.Consent` and through custom events fired on `document`
@@ -15,8 +15,13 @@ I didn't like sending 100KB+ for a simple cookie consent solution so I wrote thi
15
15
- Injects scripts when granular consent is granted (`<script data-consent="analytics" type="text/plain" src="..."></script>`)
16
16
- Injects embedded `<script>` from script tags with `src` properties on onload (tidier markup)
17
17
- Mobile-first
18
-
- Browser support: >= 2% browserlist (No IE support, but its not impossible)
19
-
- Written with latest CSS / JS features and targetted to >= 2% using browserlist
18
+
- Browser support (targeted via `browserlist` in `package.json` - `>= 2%, last 2 years`):
19
+
- Chrome 105+,
20
+
- Edge 105+
21
+
- Safari 15.4+
22
+
- Firefox 121+
23
+
- Samsung browser 20+
24
+
- run `npm run build report` and view `index.html` to compatibility table. If you need a version to work in older browsers, update the browserlist version and modify the CSS
20
25
- 'show more' functionality for long disclaimer text
21
26
- include optional link in any text
22
27
- CSS classes on `<html>` element for consents
@@ -158,7 +163,7 @@ The easiest way to see how events work is to view the `console.debug()` calls in
-`biscuitman:inject` => `{el: $Element, parent?: $Element, time: 1718914784624}` script injected to DOM. if parent exists, it's a new tag inserted after a `src` script loaded which also had text content (a 'dependent' script = tidier convenient markup)
166
+
-`biscuitman:inject` => `{el: $Element, parent?: $Element, id?: 'script-id', time: 1718914784624}` script injected to DOM. if parent exists, it's a new tag inserted after a `src` script loaded which also had text content (a 'dependent' script = tidier convenient markup)
-`biscuitman:update` => `{data: {...currentConsentObject}, time: 1718914784624}` returns current consent object and time
164
169
-`biscuitman:delete` => `{localStorage|cookie: 'cookieName', time: 1718914784624}` fires when consent is rejected or invalidated and cookies/localStorage entries are deleted
0 commit comments