Cookie time – How to control your cookies

Today, I spent some time on the cookies. I was curious about the setup of the browser cookie for a long time. The result is pretty useful and it is way easier than I thought it should be. So here is my work below.

Cookie sample | Cookies have been saved into the browser

Cookies are transferred between the browser and the server. My study focuses on the cookie transfer from browser to server this time. Each cookie is separated by a comma, and each cookie’s attributes are separated by semicolons. The two required attributes are the ‘name’ and ‘value’ which values are always string type. The remaining attributes in the rest of the cookie’s parameters are optional.

Test the water

The code above is a sample of how I set up my first cookie in my browser. The ‘name’ value is set to ‘popup’, and the ‘value’ is ‘open_only_first_load’. After I ran the code, I got the result below.

Nice! So how can I use this as a way to increase the user experience?

As you see, the code above is using the cookie as a reference to set an alert on the website. It helps to check the existing cookie and create a new one if it is not available. You can also set the ‘expires’ in your cookie also which will give a deadline for the cookie to exist in the browser. whereas, if you don’t mention it, your cookie will be removed in 24 hours.