alorel / alo-cookie
This package is abandoned and no longer maintained.
No replacement package was suggested.
A simple JavaScript cookie manager
Package info
Language:HTML
Type:project
pkg:composer/alorel/alo-cookie
1.1
2015-11-19 16:26 UTC
This package is not auto-updated.
Last update: 2022-02-01 12:49:23 UTC
README
What is this sorcery ?
It's a simple class to manipulate cookies in an object-oriented manner.
Usage
Get all document cookies
var cookies = AloCookie.getAll();
// {name1:value1, name2:value2 ...}
Setting cookie "foo"
var cookie = new AloCookie("foo");
cookie.value = "bar";
cookie.expire = 3600; //in 1 hour. Defaults to expire at the end of the session
cookie.domain = "www.example.com"; //defaults to window.location.hostname
cookie.path = "/cart/checkout"; // Defaults to "/"
cookie.secure = true; // true sends the cookie only via HTTPS. Defaults to window.location.protocol == "https:"
cookie.save()
Check if cookie called "foo" exists
var cookie = new AloCookie("foo"),
cookieExists = cookie.exists();
Deleting cookie "foo"
var cookie = new AloCookie("foo");
cookie.remove();
