What is HTTP cookie?
When a server communicates with client’s computer then for identification sever needs some sort of unique token from client side to identify specific client server and here comes the role of cookies. SO what are cookies. According to MDN
An HTTP cookie (web cookie, browser cookie) is a small piece of data that a server sends to the user’s web browser. The browser may store it and send it back with the next request to the same server. Typically, it’s used to tell if two requests came from the same browser — keeping a user logged-in, for example. It remembers statefull information for the stateless HTTP protocol.
So the server send the specific data to client end and then client browser use this data in further requests to provide it’s unique idenity to server. In this way when a browser requests a web page from a server, cookies correspoding to the website is added to the http request and server returns the unique data for the request.
Application of Cookies
Session management : Login details/session,
Personalization: User preferences, themes, and other settings
Tracking: User behaviour on site
Secure Cookies (HTTPOnly cookies )
These cookies are sent win an encrypted form over network and these cookies can’t be read / modify by client side JS. For this type of cookies user can’t access using them by document.cookie() API and for these cookies HTTP Only flag is set to true.
For More help visit here Best Web Developer