Skip to content

Cookies-enabler.js is a easy-to-use pure Javascript solution for preventively blocking third-party cookies installed by js.

Notifications You must be signed in to change notification settings

studioup/cookies-enabler

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cookies-enabler.js

Cookies-enabler.js is a easy-to-use pure Javascript solution for preventively blocking third-party cookies installed by js.

How to install

1 - Load the script

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

2 - Add the class "ce-elm" and type="text/plain" to scripts that install cookies

<script type="text/plain" class="ce-elm">
    // GA Demo
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-XXXXX-X']);
    _gaq.push(['_trackPageview']);
    ...
</script>

<script type="text/plain" class="ce-elm">
    // FB Share Demo
    (function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    ...
</script>

3 - Initiate the plugin

COOKIES_ENABLER.init();

Options

COOKIES_ENABLER.init({
    element: 'ce-elm',               // Default
    bannerHTML: 'This website uses cookies. <a href="#" class="ce-trigger">Enable Cookies</a>',   // Default
    duration: '365',                 // Default
    eventScroll: false               // Default
});

About

Cookies-enabler.js is a easy-to-use pure Javascript solution for preventively blocking third-party cookies installed by js.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 58.2%
  • PHP 19.2%
  • HTML 11.7%
  • CSS 10.9%