Milan Lund logo

Hi, I am Milan Lund!Freelance Web Developer with Kentico Expertise

I specialize in building and maintaining websites on the Kentico platform.

  • Web development

Simple cookie bar

EU cookie legislation requires website owners to inform visitors about the use of cookies. In this article, I will provide you with a simple solution of an informative cookie bar.

What it does

When a page gets loaded, a message shows up. If the visitor closes the message, a localStorage flag gets set, and the message won´t display any more. See the example.

The code

The solution consists of 2 parts:

  • logic based on Javascript and
  • styling.

Both parts need to be implemented in the website to make it work. For javascript, you can find jQuery and vanilla implementations below.
For styling, you can choose from CSS or LESS implementations.

Please, note that the javascript code relies on the existence of the .footer element. You can, of course, change it according to your taste.



Vanilla javascript






About the author

Milan Lund is a freelance web developer with expertise in Kentico. He specializes in building and maintaining websites on the Kentico platform. Milan writes articles based on his project experiences to assist both his future self and other developers.

Find out more
Milan Lund