Projects | Contribute in GitHub

litejs

Browser Cookie Lite

Get and set the cookies associated with the current document in browser.

API

// Get a cookie
cookie(name) -> String

// Set a cookie
cookie(name, value, [ttl], [path], [domain], [secure]) -> String

Examples

// simple set
cookie("test", "a")

// complex set - cookie(name, value, ttl, path, domain, secure)
cookie("test", "a", 60*60*24, "/api", "*.example.com", true)

// get
cookie("test")

// destroy
cookie("test", "", -1)

Notes

Licence

Copyright (c) 2012-2018 Lauri Rooden <[email protected]>
The MIT License


Tags: browser, cookie, litejs

Have an update or suggestion for this note? You can edit it and send me a pull request.

Fork me on GitHub

Since 2013 to 2015