Table of Contents

getCookie()

wrtc.getCookie() returns requested cookie value.

The cookie can be used to store settings and other important values to remember. Cookies are stored locally by browser and can be recalled even after page has been reloaded. Storage of cookie values are pretty straightforward but retrieval is more complicated, hence this helper function in wrtc_kit.

Arguments

wrtc.getCookie(key)

Returns

String containing value of requested key in cookie, or null if key is not found in cookie.

Events

None.

Example

Store foo=bar in cookie:

document.cookie = 'foo=bar; expires=Fri, 31 Dec 9999 23:59:59 GMT';

Retrieve value of foo from cookie:

wrtc.getCookie("foo");

Returns "bar".

Delete foo from cookie:

document.cookie = 'foo=; expires=Fri, 31 Dec 1970 23:59:59 GMT';

Please note date 1970 in expires!