{"id":8852,"date":"2025-04-26T16:50:58","date_gmt":"2025-04-26T11:20:58","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=8852"},"modified":"2025-04-26T16:54:15","modified_gmt":"2025-04-26T11:24:15","slug":"understanding-javascript-cookies","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/understanding-javascript-cookies\/","title":{"rendered":"JavaScript Cookies"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">JavaScript Cookies: Set, Get, and Delete<\/h1>\n\n\n\n<p>Small data files called cookies are kept in the user&#8217;s browser and are frequently used to track sessions, remember user preferences, or store temporary data.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What Are Cookies?<\/h2>\n\n\n\n<p>Cookies are key-value pairs that websites save in the browser. They enable websites to preserve stateful data (such as user login status) by being sent with each HTTP request to the server. Each cookie may have properties such as path, domain, and expiration date.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Setting Cookies with JavaScript<\/h2>\n\n\n\n<p>You assign a string to a document in order to set a cookie. cookie with the following format: path=\/; expires=date; name=value. The path=\/ makes the cookie available throughout the website, and the expires attribute specifies when the cookie expires.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function setcookies(){\n  \/\/ console.log(\"hi\");\n  let date = new Date();\n  \/\/ console.log(\"hi2\"+date);\n  date.setTime(date.getTime()+(7*24*60*60*1000));\n  let expire = \"expire=\"+ date.toUTCString();\n  \/\/ console.log(\"hi2\"+expire);\n  document.cookie= \"username=Sujith;\"+ expire + \"; path=\/\"; \/\/ property\n  alert(\"Cookie set : username=Sujith\")\n}\n\n<img loading=\"lazy\" decoding=\"async\" width=\"2880\" height=\"922\" class=\"wp-image-8857\" style=\"width: 800px\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-3.50.43\u202fPM-1.png\" alt=\"\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-3.50.43\u202fPM-1.png 2880w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-3.50.43\u202fPM-1-300x96.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-3.50.43\u202fPM-1-1024x328.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-3.50.43\u202fPM-1-768x246.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-3.50.43\u202fPM-1-1536x492.png 1536w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-3.50.43\u202fPM-1-2048x656.png 2048w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-3.50.43\u202fPM-1-850x272.png 850w\" sizes=\"auto, (max-width: 2880px) 100vw, 2880px\" \/><\/code><\/pre>\n\n\n\n<p>This function creates a cookie with the specified name and value, and optionally sets an expiration date based on the number of days.<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Getting Cookies with JavaScript<\/h2>\n\n\n\n<p>The document must be parsed in order to retrieve a cookie. cookie string, which includes a list of all cookies separated by semicolons. By splitting this string, you can look up the desired cookie by name.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function getCookie(name) {\n  const nameEQ = name + \"=\";\n  const cookies = document.cookie.split(\";\");\n  for (let cookie of cookies) {\n    cookie = cookie.trim();\n    if (cookie.startsWith(nameEQ)) {\n      return cookie.substring(nameEQ.length);\n    }\n  }\n  return null;\n}\n\n\/\/ Get the value of the \"username\" cookie\nconst username = getCookie(\"username\");\nconsole.log(username);\n<\/code><\/pre>\n\n\n\n<p>This function searches for a cookie by name and returns its value or null if not found.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"2876\" height=\"828\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-4.46.45\u202fPM.png\" alt=\"\" class=\"wp-image-8862\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-4.46.45\u202fPM.png 2876w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-4.46.45\u202fPM-300x86.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-4.46.45\u202fPM-1024x295.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-4.46.45\u202fPM-768x221.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-4.46.45\u202fPM-1536x442.png 1536w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-4.46.45\u202fPM-2048x590.png 2048w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-4.46.45\u202fPM-850x245.png 850w\" sizes=\"auto, (max-width: 2876px) 100vw, 2876px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Deleting Cookies with JavaScript<\/h2>\n\n\n\n<p>To delete a cookie, you set its expiration date to a time in the past. This causes the browser to remove it immediately.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function deletecookies(){\n  \/\/ document.cookie = \"username = ;\" + expire + \"Thu, 01 jan 1999 00:00:00 UTC; path=\/\";\n  document.cookie = \"username=; expire = Thu, 01 jan 1970 00:00:00 UTC; path=\/\";\n  alert(\"cookie deleted\")\n}\n<\/code><\/pre>\n\n\n\n<p>By setting the expires attribute to a past date (e.g., 1970), the cookie is marked for deletion.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-4.47.55\u202fPM.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"334\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-4.47.55\u202fPM-1024x334.png\" alt=\"\" class=\"wp-image-8863\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-4.47.55\u202fPM-1024x334.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-4.47.55\u202fPM-300x98.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-4.47.55\u202fPM-768x250.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-4.47.55\u202fPM-1536x500.png 1536w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-4.47.55\u202fPM-2048x667.png 2048w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-4.47.55\u202fPM-850x277.png 850w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Full Example: Code<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>    function setcookies(){\n      \/\/ console.log(\"hi\");\n      let date = new Date();\n      \/\/ console.log(\"hi2\"+date);\n      date.setTime(date.getTime()+(7*24*60*60*1000));\n      let expire = \"expire=\"+ date.toUTCString();\n      \/\/ console.log(\"hi2\"+expire);\n      document.cookie= \"username=Sujith;\"+ expire + \"; path=\/\"; \/\/ property\n      alert(\"Cookie set : username=Sujith\")\n    }\n\n    function getCookie(name) {\n      const nameEQ = name + \"=\";\n      const cookies = document.cookie.split(\";\");\n      for (let cookie of cookies) {\n        cookie = cookie.trim();\n        if (cookie.startsWith(nameEQ)) {\n          return cookie.substring(nameEQ.length);\n        }\n      }\n      return null;\n    }\n\n    \/\/ Get the value of the \"username\" cookie\n    const username = getCookie(\"username\");\n    console.log(username);\n\n    function deletecookies(){\n      \/\/ document.cookie = \"username = ;\" + expire + \"Thu, 01 jan 1999 00:00:00 UTC; path=\/\";\n      document.cookie = \"username=; expire = Thu, 01 jan 1970 00:00:00 UTC; path=\/\";\n      alert(\"cookie deleted\")\n    }\n  \n<img loading=\"lazy\" decoding=\"async\" width=\"2880\" height=\"998\" class=\"wp-image-8860\" style=\"width: 800px\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-3.58.46\u202fPM.png\" alt=\"\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-3.58.46\u202fPM.png 2880w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-3.58.46\u202fPM-300x104.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-3.58.46\u202fPM-1024x355.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-3.58.46\u202fPM-768x266.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-3.58.46\u202fPM-1536x532.png 1536w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-3.58.46\u202fPM-2048x710.png 2048w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/04\/Screenshot-2025-04-26-at-3.58.46\u202fPM-850x295.png 850w\" sizes=\"auto, (max-width: 2880px) 100vw, 2880px\" \/>\n\n\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>A straightforward yet effective method of storing data in the browser is through JavaScript cookies. Effective user data management is possible with the help of the setCookie, getCookie, and deleteCookie functions. When using cookies, always keep security and browser compatibility in mind.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>JavaScript Cookies: Set, Get, and Delete Small data files called cookies are kept in the user&#8217;s browser and are frequently used to track sessions, remember user preferences, or store temporary data. What Are Cookies? Cookies are key-value pairs that websites save in the browser. They enable websites to preserve stateful&hellip; <a href=\"https:\/\/pheonixsolutions.com\/blog\/understanding-javascript-cookies\/\" class=\"more-link read-more\" rel=\"bookmark\">Continue Reading <span class=\"screen-reader-text\">JavaScript Cookies<\/span><i class=\"fa fa-arrow-right\"><\/i><\/a><\/p>\n","protected":false},"author":514,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":{"0":"post-8852","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-uncategorized","7":"h-entry","9":"h-as-article"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Pheonix Solutions - We Empower Your Business Growth<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/pheonixsolutions.com\/blog\/understanding-javascript-cookies\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pheonix Solutions - We Empower Your Business Growth\" \/>\n<meta property=\"og:description\" content=\"JavaScript Cookies: Set, Get, and Delete Small data files called cookies are kept in the user&#8217;s browser and are frequently used to track sessions, remember user preferences, or store temporary data. What Are Cookies? Cookies are key-value pairs that websites save in the browser. They enable websites to preserve stateful&hellip; Continue Reading JavaScript Cookies\" \/>\n<meta property=\"og:url\" content=\"https:\/\/pheonixsolutions.com\/blog\/understanding-javascript-cookies\/\" \/>\n<meta property=\"og:site_name\" content=\"PHEONIXSOLUTIONS\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-26T11:20:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-26T11:24:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/09\/PX2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"3837\" \/>\n\t<meta property=\"og:image:height\" content=\"2540\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"sujith k\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pheonixsolution\" \/>\n<meta name=\"twitter:site\" content=\"@pheonixsolution\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"sujith k\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/understanding-javascript-cookies\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/understanding-javascript-cookies\\\/\"},\"author\":{\"name\":\"sujith k\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/9dae21345bec4359dc69cdb1706b96ea\"},\"headline\":\"JavaScript Cookies\",\"datePublished\":\"2025-04-26T11:20:58+00:00\",\"dateModified\":\"2025-04-26T11:24:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/understanding-javascript-cookies\\\/\"},\"wordCount\":295,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/understanding-javascript-cookies\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/understanding-javascript-cookies\\\/\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/understanding-javascript-cookies\\\/\",\"name\":\"Pheonix Solutions - We Empower Your Business Growth\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#website\"},\"datePublished\":\"2025-04-26T11:20:58+00:00\",\"dateModified\":\"2025-04-26T11:24:15+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/understanding-javascript-cookies\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/understanding-javascript-cookies\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/understanding-javascript-cookies\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript Cookies\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\",\"name\":\"Pheonix Solutions\",\"description\":\"We Empower Your Business Growth\",\"publisher\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\",\"name\":\"PheonixSolutions\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/logo.png\",\"contentUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/logo.png\",\"width\":454,\"height\":300,\"caption\":\"PheonixSolutions\"},\"image\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/PheonixSolutions-209942982759387\\\/\",\"https:\\\/\\\/x.com\\\/pheonixsolution\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/9dae21345bec4359dc69cdb1706b96ea\",\"name\":\"sujith k\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/41c5d1c0dfe05033e1ef6be41e96d1e926b8a6065292fb95c1862a0ffca3ad20?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/41c5d1c0dfe05033e1ef6be41e96d1e926b8a6065292fb95c1862a0ffca3ad20?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/41c5d1c0dfe05033e1ef6be41e96d1e926b8a6065292fb95c1862a0ffca3ad20?s=96&r=g\",\"caption\":\"sujith k\"},\"sameAs\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-admin\"],\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/author\\\/sujith\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pheonix Solutions - We Empower Your Business Growth","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/pheonixsolutions.com\/blog\/understanding-javascript-cookies\/","og_locale":"en_US","og_type":"article","og_title":"Pheonix Solutions - We Empower Your Business Growth","og_description":"JavaScript Cookies: Set, Get, and Delete Small data files called cookies are kept in the user&#8217;s browser and are frequently used to track sessions, remember user preferences, or store temporary data. What Are Cookies? Cookies are key-value pairs that websites save in the browser. They enable websites to preserve stateful&hellip; Continue Reading JavaScript Cookies","og_url":"https:\/\/pheonixsolutions.com\/blog\/understanding-javascript-cookies\/","og_site_name":"PHEONIXSOLUTIONS","article_publisher":"https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/","article_published_time":"2025-04-26T11:20:58+00:00","article_modified_time":"2025-04-26T11:24:15+00:00","og_image":[{"width":3837,"height":2540,"url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/09\/PX2.png","type":"image\/png"}],"author":"sujith k","twitter_card":"summary_large_image","twitter_creator":"@pheonixsolution","twitter_site":"@pheonixsolution","twitter_misc":{"Written by":"sujith k","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pheonixsolutions.com\/blog\/understanding-javascript-cookies\/#article","isPartOf":{"@id":"https:\/\/pheonixsolutions.com\/blog\/understanding-javascript-cookies\/"},"author":{"name":"sujith k","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/person\/9dae21345bec4359dc69cdb1706b96ea"},"headline":"JavaScript Cookies","datePublished":"2025-04-26T11:20:58+00:00","dateModified":"2025-04-26T11:24:15+00:00","mainEntityOfPage":{"@id":"https:\/\/pheonixsolutions.com\/blog\/understanding-javascript-cookies\/"},"wordCount":295,"commentCount":0,"publisher":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#organization"},"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/pheonixsolutions.com\/blog\/understanding-javascript-cookies\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/pheonixsolutions.com\/blog\/understanding-javascript-cookies\/","url":"https:\/\/pheonixsolutions.com\/blog\/understanding-javascript-cookies\/","name":"Pheonix Solutions - We Empower Your Business Growth","isPartOf":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#website"},"datePublished":"2025-04-26T11:20:58+00:00","dateModified":"2025-04-26T11:24:15+00:00","breadcrumb":{"@id":"https:\/\/pheonixsolutions.com\/blog\/understanding-javascript-cookies\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/pheonixsolutions.com\/blog\/understanding-javascript-cookies\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/pheonixsolutions.com\/blog\/understanding-javascript-cookies\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/pheonixsolutions.com\/blog\/"},{"@type":"ListItem","position":2,"name":"JavaScript Cookies"}]},{"@type":"WebSite","@id":"https:\/\/pheonixsolutions.com\/blog\/#website","url":"https:\/\/pheonixsolutions.com\/blog\/","name":"Pheonix Solutions","description":"We Empower Your Business Growth","publisher":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/pheonixsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/pheonixsolutions.com\/blog\/#organization","name":"PheonixSolutions","url":"https:\/\/pheonixsolutions.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/logo.png","contentUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/logo.png","width":454,"height":300,"caption":"PheonixSolutions"},"image":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/","https:\/\/x.com\/pheonixsolution"]},{"@type":"Person","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/person\/9dae21345bec4359dc69cdb1706b96ea","name":"sujith k","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/41c5d1c0dfe05033e1ef6be41e96d1e926b8a6065292fb95c1862a0ffca3ad20?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/41c5d1c0dfe05033e1ef6be41e96d1e926b8a6065292fb95c1862a0ffca3ad20?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/41c5d1c0dfe05033e1ef6be41e96d1e926b8a6065292fb95c1862a0ffca3ad20?s=96&r=g","caption":"sujith k"},"sameAs":["https:\/\/pheonixsolutions.com\/blog\/wp-admin"],"url":"https:\/\/pheonixsolutions.com\/blog\/author\/sujith\/"}]}},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7F4uM-2iM","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8852","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/514"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=8852"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8852\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=8852"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=8852"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=8852"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}