Loading...

Admin


Published at : February 15, 2019


Read Time: 5 mints


Share the post :

facebookinstagramlinkedin

Using cookies in JavaScript

Using cookies in JavaScript

Cookies are small items of data, each consisting of a name and value,
stored on behalf of a website by visitors’ web browsers. In JavaScript, cookies can be accessed through the document.Cookies.js is a JavaScript object that allows cookies to be created, retrieved, and deleted through a simple and intuitive interface.
Download the Cookies.js files below and use them for cookies.

how to SetCookie:

Cookie.Set(\'color\',\'blue\');

For creating cookies set 2 parameters cookie name and parameter.
The value of the property can be either a date on which the cookie will expire or a number of seconds after which the cookie should expire:

Cookies.set(\'theme\', \'green\', {expiry : 3600});

if you want cookies to access only one domain then
Cookies.set(‘name’, ‘Shilpa’, {expiry : new Date(2030, 0, 1)});

Retrieving Cookies

if you retrieve, the cookie’s value then,

var theme = Cookies.get(\'color\');

Deleting cookies

if you delete the value of the cookie then,

Cookies.clear(\'color\');

For details please see http://code.iamkate.com/javascript/using-cookies/

Existing Blogs

  • The Future of Virtual Classrooms: EdTech Trends in 2024

    BY Admin | Jun 30, 2025

    The Future of Virtual Classrooms: EdTech Trends in 2024


    Read more
  • The Hilarious World of Remaker AI Face Swaps: Funny Ideas To Try Today

    BY Admin | Jun 30, 2025

    The Hilarious World of Remaker AI Face Swaps: Funny Ideas To Try Today


    Read more
  • Top 13 Web Development Companies in Kolkata 2025

    BY Admin | Jun 30, 2025

    Top 13 Web Development Companies in Kolkata 2025


    Read more
  • Hire dedicated Codelgniter developer to meet your needs!

    BY Admin | Jun 30, 2025

    Hire dedicated Codelgniter developer to meet your needs!


    Read more
Loading...
Blog Detail - WIS