Cookie

Allows apps to store, retrieve, and erase cookies against the host Jira/Confluence. These cannot be seen by other apps.

Methods

erase (name)

Remove the given cookie.

Parameters

NameTypeDescription
nameStringthe name of the cookie to remove

Example

1
2
AP.require("cookie", function(cookie){
  cookie.save('my_cookie', 'my value', 1);
  cookie.read('my_cookie', function(value) { alert(value); });
  cookie.erase('my_cookie');
});

read (name, callback)

Get the value of a cookie.

Parameters

NameTypeDescription
nameStringname of cookie to read
callbackfunctioncallback to pass cookie data

Example

1
2
AP.require("cookie", function(cookie){
  cookie.save('my_cookie', 'my value', 1);
  cookie.read('my_cookie', function(value) { alert(value); });
});

save (name, value, expires)

Save a cookie.

Parameters

NameTypeDescription
nameStringname of cookie
valueStringvalue of cookie
expiresNumbernumber of days before cookie expires

Example

1
2
AP.require("cookie", function(cookie){
  cookie.save('my_cookie', 'my value', 1);
});

Rate this page: