Press "Enter" to skip to content

Create a Cookie Notice with Vanilla JavaScript | CookieNoticeJS

CookieNoticeJS is a very simple and small (← 2 kB gzip) vanilla JS script that provides an easy way to show this cookie notification on your website.

cookie consent javascript, cookie consent javascript github, cookie consent popup javascript, free cookie consent code html, set cookie for popup javascript

Note: CookieNoticeJS is not in active development at the moment (and not GDPR compliant as far as I know). Check out the AOEPeople fork instead.

How to make use of it:

Just download and embody the cookie.notice.js in your doc and finished.

<script src="src/cookie.notice.js"></script>

Override the default settings by enhancing the cookie.notice.js.

var defaults = {
    'messageLocales': {
        'it': 'Utilizziamo i cookie per essere sicuri che tu possa avere la migliore esperienza sul nostro sito. Se continui ad utilizzare questo sito assumiamo che tu ne sia felice.',
        'en': 'We use cookies to make sure you can have the best experience on our website. If you continue to use this site we assume that you will be happy with it.',
        'de': 'Wir verwenden Cookies, um sicherzustellen, dass Sie das beste Erlebnis auf unserer Website haben können. Indem Sie unsere Dienste stimmen Sie der Verwendung in Übereinstimmung mit unseren Cookies Richtlinien.',
        'oc': 'Utilizam de cookies per vos provesir la melhora experiéncia possibla sus nòstre site web. Se contunhatz d\'utilizar aqueste site web considerarem que sètz d\'acòrdi amb aquò.',
        'fr': 'Nous utilisons des cookies afin d\'être sûr que vous pouvez avoir la meilleure expérience sur notre site. Si vous continuez à utiliser ce site, nous supposons que vous acceptez.'
    'buttonLocales': {
        'en': 'Ok'
    'cookieNoticePosition': 'bottom',
    'learnMoreLinkEnabled': false,
    'learnMoreLinkHref': '/cookie-banner-information.html',
    'learnMoreLinkText': {
      'it': 'Saperne di più',
      'en': 'Learn more',
      'de': 'Mehr erfahren',
      'fr': 'En savoir plus'
    'buttonLocales': {
      'en': 'Ok'
    'expiresIn': 30,
    'buttonBgColor': '#d35400',
    'buttonTextColor': '#fff',
    'noticeBgColor': '#000',
    'noticeTextColor': '#fff',
    'linkColor': '#009fdd'

Creating Cookie Notification, CookieNoticeJS Plugin/Github, pure css cookie bar

See Demo And Download

Official Website(micc83): Click Here

This superior jQuery/javascript plugin is developed by micc83. For extra advanced usage, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published.