Skip to content

Instantly share code, notes, and snippets.

@johnchambers
Created December 16, 2014 15:08
Show Gist options
  • Save johnchambers/5a6e67f2d7d39031af17 to your computer and use it in GitHub Desktop.
Save johnchambers/5a6e67f2d7d39031af17 to your computer and use it in GitHub Desktop.
Bootstrap 3 - Footer Cookie Alert/Banner
<div id="cookie_directive_container" class="container" style="display: none">
<nav class="navbar navbar-default navbar-fixed-bottom">
<div class="container">
<div class="navbar-inner navbar-content-center" id="cookie_accept">
<a href="#" class="btn btn-default pull-right">Close</a>
<p class="text-muted credit">
By using our website you are consenting to our use of cookies in accordance with our <a href="/cookies">cookie policy</a>.
</p>
<br>
</div>
</div>
</nav>
</div>
@RobbiewOnline
Copy link

Hey thanks for such a great light-weight cookie policy banner.

Personally, I wouldn' make it so when you click on the cookie policy link it sets the cookie, only after they explicitly click on the button instead, i.e.

$("#cookie_accept .btn").click(function(){
            setCookie_eu("cookies_consent", 1, 30);
});

By default, most people will likely want the cookie policy in a separate window, so I'd suggest your template could use target="_blank".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment