There is no way you can skip cookies if you are a developer. A cookie is today as important in internet as any language. Cookies has made our way simpler and better, both for the developer and the user. So in this chapter we will focus on.
What is a cookie?
Cookie in simpler terms means just the textual information about some website. When you visit a particular website, some information is saved in your local system so that when you visit the same website again, this website is able to recognize you and show you the results according to your preferences. Cookies have been long used in the internet history and have developed in a magnificent way.
When you visit a website you actually requests the web page from the server. For a server, every request is a unique request. So if you visit hundred times, the server will consider each and every request unique. Since the intensity of requests that arrive at a server is high, it is obvious and logical not to store every user's information to the server. Maybe you never visit again and the same information will be redundant. So, to uniquely remember you, the server sends the cookies along with the response which is saved in your local machine. Now the next time you hit the same server, you will get a response according to you as the server will recognize you.
This cookie is unique to every server (some exceptions exist today because of advertisements). So you might have many cookies in your system but a server will recognize it's own cookie and can analyse it for you. How this evolved over time and used today is discussed in the next section.
Why to use cookies?
Cookies developed in the initial days because developers needed some information about the client to make their experience better. Let say you visit a website which is not in your local language (let's say English). You choose the English option in the language section of the website. Now if you visit the same website 5 times a day, you might have to change the language 5 times. Therefore, this information is saved as a cookie in your system. So the next time you send the request, the server will know that you want to see the website in english. This is where cookies play a vital role. But this is a very minute example of the scale cookies are used today.
Advancement of cookies:
The concept of cookies was developed for creating a better experience by saving little information as texts on the client's machine. But as the concept became more and more demanding and successful, the usage of cookies increased many folds. Today, cookies are used from what you searched to even what you saved in your cart. Cookies are used today at an extreme level saving your information about various websites. Knowing this, it is obvious that the size of the information has increased. So developers have recognized that all the information cannot be saved in the client's machine as it will increase the cookie size which is sent with requests and also will load the client's machine. Therefore cookies are now saved in a different way.
Now, if you visit a website, the website provide you with a cookie id which is uniquely recognizable by the server. This id is then linked to the database of the company where all your information is saved and then fetched from the database. This way cookies can be managed more efficiently and more securely.
Security threats related to Cookies:
Cookies as you must have come to know till now, saves your information to your machine. This information is highly personal to you and should only be retrieved by the server which saved it. Does it possess any security threats? Fortunately no. The following things should be kept in mind:
- A cookie cannot be used by any other server as the id saved in your cookie is directly mapped to the website's database.
- A cookie can never be used to access any information saved in your system, browser or hard disk.
- A cookie cannot be used to deliver viruses or any other threats.
- A cookie but can be used by a third website (with permissions of course) to access the information and/or your preferences to use them for their and your benefit. To understand it a bit more, we should understand the types of cookies.
Refer for -
How cookies are used in a website?
Similar Reads
curl Command in Linux with Examples curl is a command-line utility for transferring data to or from a server, employing a range of internet protocols such as HTTP, HTTPS, FTP, SCP, and SFTP.Whether you want to download a file, test a REST API, or simply verify that a website is up and running, curl is your best friend. It is accessed
5 min read
Web Development Prerequisites If youâre thinking about starting web development, youâre about to begin an exciting journey! But before you jump in and start coding, itâs a good idea to understand the basics of how the web works. Knowing all the key concepts and tools before you actually start learning them will help you get a cl
13 min read
What is HTTP ? HTTP (Hypertext Transfer Protocol) is a fundamental protocol of the Internet, enabling the transfer of data between a client and a server. It is the foundation of data communication for the World Wide Web. HTTP provides a standard between a web browser and a web server to establish communication. It
5 min read
HTTP Tutorial HTTP [HyperText Transfer Protocol] is an application layer protocol that has the responsibility of transferring hypertext that includes audio, video, text, images, and other important multimedia files. So, in this HTTP tutorial, we will analyze and understand the concept and applications of HTTP wit
5 min read
A Typical HTTP Session In web communications, Hypertext Transfer Protocol (HTTP) is the cornerstone of data exchange between clients (typically web browsers) and servers. An HTTP session represents the lifecycle of the single request-response cycle between these two entities. Let us explore the steps involved in a typical
5 min read
How HTTP Evolved Throughout The Years? HTTP... The Protocol of the Web.If you are a person who takes an interest in computer science topics, then you might be aware of the importance of this four-character word. Every time you see this word at the beginning of the URL of any kind of website but have you ever tried to know how it works an
6 min read