Shiny Language Reference

Language Reference > Web Functions


wsetcookie

bool wsetcookie(web WebVar, string URL, string Name, string Data);

 

Synonyms:

bool websetcookie(web WebVar, string URL, string Name, string Data);
 
 

Sets a cookie for use with web connections

The WSETCOOKIE statement creates and sets a cookie for the variable of type WEB (parameter 1). Cookies are used by websites to track usage, authentication details, preferences and more. Detailed discussion of cookies and cookie usage is outside the scope of this reference.

Note: this feature is considered experimental. Please submit bug reports and feature requests as appropriate.

 

Parameters

WebVar

A variable declared as type WEB, which will be "given" the cookie. Future use of this variable for website access will automatically use any cookies set with WSETCOOKIE. For clarity, think of a WEB variable as an instance of a web browser.

URL

The URL of the cookie. This parameter is extremely important and has operational as well as security implications. Do not proceed unless you are confident with cookies and cookie usage.

Name

The name of the cookie. This is distinct and different to the URL of the cookie.

Data

The actual cookie data used by the remote website.

 

Return Value

TRUE if the cookie creation suceeded, otherwise FALSE.

 

Example Code

No example code available. Creation of a cookie is purely based on the requirements of the website that uses it.