Skip to content
Advertisement

Python Flask cookie consent

I want to set a banner that asks for permission to store cookies on my website(because GDPR). I’ve tried like this: HTML:

JavaScript

and jinja2

JavaScript

The prints are for debugging. The problem is that the list is always empty and the banner is never showing. What should I do to make this work? Does that mean that the site is not generating any cookie to begin with? If so how can I add a cookie when the site is loaded?

Advertisement

Answer

A cookie can be added,read,deleted using document.cookie

JavaScript

By default cookie delete after browser is closed.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement