readCookie
Last updated
Was this helpful?
readCookie FunctionThe readCookie function is used to retrieve the value of a client-side first-party cookie by its name.
this.readCookie(cookieName: string): string | nullcookieName (string, required):
The name of the cookie you want to read.
If the cookie is found: Returns the cookie value as a string.
If the cookie is not found: Returns null.
Example 1: Read an existing cookie
function() {
var val = this.readCookie("JTS-RW");
return val; // Value of the cookie
}This example returns the value stored in the cookie named JTS-RW.
Example 2: Read a non-existing cookie
This example attempts to read a cookie that does not exist. As a result, it returns null.
Last updated
Was this helpful?
Was this helpful?
function() {
var val = this.readCookie("JTS-RW");
return val; // null
}