Elementals.js

Latest Version: 3.0 RC 1 17 July 2017

Method _.Cookies.set

Summary:

Sets a browser cookie

You can pass any loose 'false' value to optional parameters to skip them if desired to get at the deeper nested ones.

Calling Convention:
_.Cookies.set(name, value[, time[, path[, domain[, secure]]]])
Parameters:
name
The cookie's name
value
Value to set on the cookie
time optional
When the cookie should expire. Can be stated as any value you could pass to JavaScript's Date object, or as a string in the same format as Date.toGMTString. If omitted, a date significantly far enough into the future to be considered "forever" is used. Specifically 6 June, 3052. Inside Joke.
path optional
The path to which the cookie is applied. If omitted or loose false, it will apply to all paths on the domain.
domain optional
The domain the cookie is for. If omitted or loose false, the current domain is assumed.
secore optional
Loose boolean, if set the cookie will only apply to SSL/TLS connections -- aka when served via HTTPS instead of HTTP.
Returns:
Nothing

Advertisement