An HTTP cookie (also called web browser cookies, Internet cookie, browser cookies or simply cookie) is a small piece of data sent from a website and stored in the user’s web browser while the user is browsing.
- 1 Purpose of browser cookies
- 2 Types of Browser Cookies
- 3 Structure of a Cookie
- 4 Drawbacks of Cookies
- 5 Cookie theft
- Record users activity such as browsing history, click patterns, page visits and so on.
- keep track of items in the shopping cart.
- enable automatic user login by eliminating the use of password input if you have saved password on that site.
Types of Browser Cookies
A session browser cookie, also known as an in-memory cookie or transient cookie, exists only in temporary memory while the user navigates the website.Web browsers normally delete session cookies when the user closes the browser. session cookies do not have an expiration date assigned to them.
A persistent browser cookie facilitates websites to track user settings and information when they visit the same website in the future. persistent cookies are sometimes referred to as tracking cookies because they can be used by advertisers to record information about a user’s web browsing habits over an extended period of time.
It can only be transmitted over an encrypted connection (i.e HTTPS) and thus offer protection against cookie theft.
it is a cookie with an origin of a top-level domain (such as .com) or a public suffix like (co.uk). Supercookies can be a potential security concern and are therefore often blocked by web browsers.
5. Third-Party Cookie
it belongs to a domain different from the one shown in the address bar. as an example when you visit a website (www.pqr.com) all the cookies that come from this website are called first–party cookies. Suppose, if this website (www.pqr.com) is running an advertisement on its page from a third party website (www.cvb.com) then the cookie that originates from this website (www.cvb.com) is referred to as a third-party cookie.
Structure of a Cookie
A cookie consists of the following components
- Zero or more attributes
- domain associated with the cookie
- expiry information
Drawbacks of Cookies
1. Inaccurate identification
If more than one browser is used on a computer, each usually has a separate storage area for cookies. Hence cookies do not identify a person, but a combination of a user account, a computer, and a web browser. Thus, anyone who uses multiple accounts, computers, or browsers has multiple sets of cookies.Likewise, cookies do not differentiate between multiple users who share the same user account, computer, and browser.
2. Accidental Deletion
In many cases, cookies can get erased accidentally when you clear your browsing history or use a third party cookie cleaner program. When this happens all your stored settings and preference gets lost and the website treats you as a completely new user.