JavaScript document.cookie Property

You are Here:

JavaScript document.cookie Property

The document.cookie property lets you read and write cookies associated with the document.

Tips: To learn more about cookies, please navigate to our cookies section.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <script> // set a cookie var name = "The Jungle Book"; document.cookie = "movie="+name+";path=/"; // Read all cookie allcookie = document.cookie; console.log(allcookie); </script> </body> </html>

Syntax

document.cookie

Return Values

ValueExplanation
StringReturns a semicolon-separated list of the cookies for that document or sets a single cookie.

Reminder

Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in JavaScript.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author