HTML, CSS & JavaScript - How to Create a Cookie Consent Message

Поделиться
HTML-код
  • Опубликовано: 3 янв 2022
  • In this video, we'll show you how to create a cookie consent message and a cookie with an expiration date so the message does not show up every time the user visits the website.
    More information on how to create a cookie (very easy to follow):
    www.w3schools.com/js/js_cooki...
    Sponsor me on GitHub!
    github.com/sponsors/miguelznunez
    Follow my blog:
    / miguelznunez
    Email : mignunez@csumb.edu
    Medium : / miguelznunez
    Codepen : codepen.io/miguelznunez
    GitHub : github.com/miguelznunez

Комментарии • 30

  • @joebalingit
    @joebalingit 2 года назад +2

    You've got a subscriber. Thank you so much for this helpful video. Keep 'em coming...

  • @mihaelabalaceanu7905
    @mihaelabalaceanu7905 2 года назад +2

    Very well explained! Thx so much, it was so helpful!

  • @nigelhammond99
    @nigelhammond99 Год назад

    Great video! I have been looking for a good cookie banner for some time. Well explained, well coded, simple to follow. Thank you! One more subscriber here!

  • @kageyoshi3656
    @kageyoshi3656 Месяц назад

    Easy to follow, gets the job done, works flawlessly -> Subscribed! + Liked! + Shared!

  • @EinDummie
    @EinDummie Месяц назад

    Hey Sir, your Tutorial helped me alot, thank you and keep it up.

  • @agritech802
    @agritech802 4 месяца назад

    Great video, what editor are you using?

  • @chupacabrapr
    @chupacabrapr Год назад

    Thanks for the video very helpful. Im having an issue, i set the expiration date and create the cookie. The exp date shows fine, but when I refresh my browser the exp date changes to “session”. Any idea why? Thanks

  • @loonatik_official
    @loonatik_official Год назад

    thank you!

  • @MillerHighLifez420
    @MillerHighLifez420 Год назад

    Thanks!

  • @yoskokleng3658
    @yoskokleng3658 Месяц назад

    why we need it (click to store cookie)? i saw many website have done this. please make a video of benefit of it?

  • @_661.
    @_661. 6 месяцев назад

    Nice bro❤

  • @rjapade3062
    @rjapade3062 9 месяцев назад

    Can u please help me , uncaught references error: data is not defined at setCookie ??

  • @jfpicard1
    @jfpicard1 8 месяцев назад

    Question here ... To be 100% compliant .. should this "consent" be stored somewhere?

  • @jad3nk674
    @jad3nk674 2 месяца назад

    i have a question i never saw in my cookie menu with the inspect mode one that says cookie true so now i cant see the cookie and i have to show it to my teacher

  • @durangodave
    @durangodave 6 месяцев назад

    dont we need to secure the cooke?

  • @xchen6190
    @xchen6190 6 месяцев назад

    Thanks! how to give the user option to reject the cookie?

    • @agritech802
      @agritech802 4 месяца назад

      Create a button called reject and store them value reject in the cookie

  • @alexandermarcondesjunior1608
    @alexandermarcondesjunior1608 Год назад +2

    i getting this error :
    default.js:34 Uncaught TypeError: Cannot set properties of undefined (setting 'display')
    at cookieMessage
    someone can help me?

    • @codefoxx
      @codefoxx  Год назад

      It cannot find the element you are trying to add the "display" property to. Perhaps you forgot to create it, mispelled it, did not add the appropriate id, etc. Basically you are missing something. Please rewatch the tutorial

  • @bilalbehar8533
    @bilalbehar8533 2 года назад +1

    can you please help me, i followed every step , but the paragraphe inside the cookies container is empty

    • @codefoxx
      @codefoxx  2 года назад +1

      Please recheck the code you must be missing something

    • @bilalbehar8533
      @bilalbehar8533 2 года назад

      @@codefoxx i tried to follow many other videos . But still have the same problem
      Thank you anyways

    • @aruzhannurmanova3696
      @aruzhannurmanova3696 2 года назад +1

      @@codefoxx Hi! I have the same issue. maybe there are some missing parts in the code on this video? 'cause I rechecked each part and I am sure that I wrote it correctly.

    • @codefoxx
      @codefoxx  2 года назад

      @@aruzhannurmanova3696 can you share your code with me? Maybe you can share the Github repository

    • @bilalbehar8533
      @bilalbehar8533 Год назад

      @@codefoxx its working thanks

  • @AashutoshBansal
    @AashutoshBansal 2 года назад +2

    Bro can u remake video of grocery-list with localStorage, As I'm not able to do so. Please Please Please Please

    • @codefoxx
      @codefoxx  2 года назад +3

      I can do that but I actually don't recommend beginners using local storage beyond 1 or 2 basic projects because that's not how data is stored in a real application. What you wanna learn is how to store it in a database like mySQL or MongoDB, which requires knowledge of Node.js or a framework like Django or Spring Boot.

    • @AashutoshBansal
      @AashutoshBansal 2 года назад +1

      @@codefoxx ok 👍

  • @bilalbehar8533
    @bilalbehar8533 Год назад +3

    can someone pls paste the css file here

    • @adarshc7737
      @adarshc7737 8 месяцев назад

      *{
      padding: 0;
      margin: 0;
      }
      body{
      font-size: 1rem;
      }
      .container{
      width:1600px;
      margin: auto;
      }
      .subcontainer{
      width: 85%;
      margin: auto;
      }
      #cookies{
      width: 100%;
      position: fixed;
      bottom: 0;
      color: aliceblue;
      background-color: rgba(0, 0, 0, 0.311);
      z-index: 1;
      display: none;
      }
      .cookies{
      min-height: 70px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
      }
      .cookies .a{
      color: yellow;
      text-decoration: none;
      font-weight: 500;
      }
      #cookies-btn{
      border-radius: 5px;
      padding: 6px 8px 6px 8px;
      font-size: 1rem;
      font-family: inherit;
      cursor: pointer;
      border: 1px solid white;
      background-color: black;
      color: white;
      }
      @media(max-width:1600px){
      .container{
      width: 100%;
      }
      }
      @media(max-width:1024px){
      .cookies{
      padding: 10px 0;
      }
      }