JavaScript Library For Blocking Third-party Cookies Installed By JS – cookies-enabler.js

Category: Javascript , Others | January 4, 2019
Author: nicholasruggeri
Views Total: 1,980
Official Page: Go to website
Last Update: January 4, 2019
License: MIT

Preview:

JavaScript Library For Blocking Third-party Cookies Installed By JS – cookies-enabler.js

Description:

cookies-enabler.js is a simple yet fully configurable JavaScript library for preventively blocking third-party cookies installed by js and comply with the EU cookie law.

Basic usage:

Load the required stylesheet in the head section of the document.

<link rel="stylesheet" href="stylesheets/cookies-enabler.css">

Load the cookies-enabler.js script at the bottom of the document.

<script src="cookies-enabler.js"></script>

Initialization.

COOKIES_ENABLER.init({
  // OPTIONS HERE
});

Default options available.

  COOKIES_ENABLER.init({
  scriptClass: 'ce-script',
  iframeClass: 'ce-iframe',
  acceptClass: 'ce-accept',
  dismissClass: 'ce-dismiss',
  bannerClass: 'ce-banner',

  bannerHTML:
    '<p>This website uses cookies. '
        +'<a href="#" class="ce-accept">'
            +'Enable Cookies'
        +'</a>'
    +'</p>',

  eventScroll: false,
  scrollOffset: 200,

  clickOutside: false,

  cookieName: 'ce-cookie',
  cookieDuration: '365',

  iframesPlaceholder: true,
  iframesPlaceholderHTML:
    '<p>To view this content you need to'
        +'<a href="#" class="ce-accept">Enable Cookies</a>'
    +'</p>',
  iframesPlaceholderClass: 'ce-iframe-placeholder',

  // Callbacks
  onEnable: '',
  onDismiss: ''
  
});

Changelog:

01/04/2018

  • Fixed postscribe issue – call only if defined

05/26/2018

  • v0.1.2

You Might Be Interested In:


Leave a Reply