JavaScript Cookie Manager
An incredibly simple and lightweight library for adding, fetching, modifying, and removing browser cookies.
Usage
Include:
<script src ="https://gigabyte5671.github.io/CookieManager/cookieManager.min.js" type ="text/javascript"></script >
To create a cookie, call the setCookie() function with arguments for the cookie name, the value, and the lifespan (in days). (To update a cookie, just call setCookie() again with the same name and the new value)
setCookie (cookieName, cookieValue, cookieLifespan);
To retrieve the value of a cookie, call the getCookie() function with an argument for the cookie name. This will return the value of the cookie as a string.
var cookieValue = getCookie (cookieName);
To check if a cookie exists, call the checkCookie() function with an argument for the cookie name. This will return boolean true if the cookie exists, and boolean false if it doesn't.
var cookieExists = checkCookie (cookieName);
Finally, to remove a cookie, call the clearCookie() function with an argument for the cookie name.
clearCookie (cookieName);