Create, Read, and Delete Cookie in JavaScript

Cookies are data, stored in small text files, on your computer. Web servers uses cookies to identify the user when you visit Internet sites.

Your browser stores each message in a small file, called cookie.txt. When you request another page from the server, your browser sends the cookie back to the server. These files typically contain information about your visit to the web page, as well as any information that you have stored.

Only the website that creates a cookie can read it, so other servers do not have access to your information. Additionally, web servers can use only information that you provide or choices that you make while visiting the website as content in cookies.

Cookies are saved in name value pairs.

Following are the some common functions  create, read and delete the internet cookie:

Create Cookie 
Usage as: createCookie("usename", "sartaj", 60);

Read Cookie 
Delete Cookie 

Delete All Cookies

Hi! I am Sartaj Husain. I am a Professional Software Developer, live in Delhi. I write blogs in my free time. I love to learn and share the knowledge with others because it is no good to try to stop knowledge from going forward. So free posts and tutorials. more..

No comments