
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the use of JavaScript cookies?
Using cookies is the most efficient method of remembering and tracking preferences, purchases, commissions, and other information required for better visitor experience or site statistics.
Your server sends some data to the visitor's browser in the form of a cookie. The browser may accept the cookie. If it does, it is stored as a plain text record on the visitor's hard drive. Now, when the visitor arrives at another page on your site, the browser sends the same cookie to the server for retrieval. Once retrieved, your server knows/remembers what was stored earlier.
Cookies are a plain text data record of 5 variable-length fields,
- Expires - The date the cookie will expire. If this is blank, the cookie will expire when the visitor quits the browser.
- Domain - The domain name of your site.
- Path - The path to the directory or web page that set the cookie. This may be blank if you want to retrieve the cookie from any directory or page.
- Secure - If this field contains the word "secure", then the cookie may only be retrieved with a secure server. If this field is blank, no such restriction exists.
- Name=Value - Cookies are set and retrieved in the form of key-value pairs.
- Related Questions & Answers
- What are cookies in JavaScript?
- What is the use of JavaScript eval function?
- What is the use of Map in JavaScript?
- What is the use of Atomics in JavaScript?
- What is the use of OBJECT.assign() in javascript?
- What is the use of window.location in javascript?
- What is the use of sentry in javascript?
- What are secured cookies in JavaScript?
- What is the use of declaring variables in JavaScript?
- What is the use of forEach() method in JavaScript?
- What is the use of Math.pow() method in JavaScript?
- What is the use of substr() method in JavaScript?
- what is the use of slice() method in JavaScript?
- What is the use of Array.entries() method in JavaScript?
- What is the use of charAt() method in JavaScript?
Advertisements