ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Web-specific functions / Browser functions
  • Limits
  • Miscellaneous
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Writes a cookie onto the computer of the Web user.
WEBDEV - Server code The cookie is written during the next display of a WEBDEV page in the browser.
WEBDEV - Browser code The cookie is written onto the computer of the Web user.
WEBDEV - Server codePHPAjax
// -- Click on a BTN_Validate button (server code) 
// Create cookie: save user name 
// and the date of last visit
CookieWrite("NAME_AND_DATE", Name + "," + DateSys())
PageDisplay(PAGE_Purchases)
WEBDEV - Browser codePHP
// -- Click on a BTN_Save button (browser code) 
// Create a cookie: save search options
CookieWrite("SEARCHOPT", Keyword + "," + ByIDENTICAL)
Syntax
CookieWrite(<Cookie name> , <Cookie value> [, <Validity period> [, <Path> [, <Domain> [, <Type of cookie>]]]])
<Cookie name>: Character string
Name of the cookie that must be written onto the computer of the Web user. This name can be used during the call to CookieRead.
Warning: The ";" character cannot be used in the cookie name..
<Cookie value>: Character string
Value of the cookie to write onto the computer of the Web user. This value can be a list of data, miscellaneous information, etc. The maximum string size cannot exceed 4000 characters.
Please note: The ";" character and the carriage return (CR) character cannot be used in the cookie value.
<Validity period>: Optional integer
Number of days during which the cookie is valid. Once this number of days is exceeded, the cookie is automatically deleted from the computer of the Web user. The cookie is valid for 30 days by default.
<Path>: Optional character string
Path for which the cookie must be saved. This path must exist on the server. This parameter is case-sensitive.
By default (or if this parameter corresponds to an empty string), the path corresponds to "/".
Example: "/COOKIES_WEB/FR/LOGIN"
<Domain>: Optional character string
Domain for which the cookie must be saved.
  • If this parameter is not specified or is an empty string, the domain corresponds to the current domain.. The cookie will be associated with this domain only.
  • If this parameter explicitly corresponds to a domain name, the cookie will be associated with the specified domain name and with all its sub-domains.
<Type of cookie>: Optional Integer constant (or combination of constants)
Type of cookie to write:
cookieHTTPOnlyCookie that can be retrieved in server code only. This cookie cannot be read in browser code.
WEBDEV - Browser code This constant is not available.
cookieNormal
(Default value)
Cookie without specific options.
This constant cannot be combined with the other constants.
cookieSameSiteLaxType of cookie "SameSite=Lax". This type of cookie is used to prevent Cross Site Request Forgery (CSRF) attacks.
The cookie concerned by this instruction will only be sent if the request comes from the same website or from another site via an external link..
cookieSameSiteNoneCookie of type "Same Site=None". This type of cookie is used to prevent Cross Site Request Forgery (CSRF) attacks.
Cookies will be sent regardless of the call context.
cookieSameSiteStrictCookie of type "SameSite=Strict". This type of cookie is used to prevent Cross Site Request Forgery (CSRF) attacks.
The cookie concerned by this instruction will only be sent if the request comes from the same website.. It will therefore not be sent on a first visit to a site page, but only on subsequent actions.
cookieSecureCookie transmitted in an HTTPS request only.
Remarks

Limits

  • The maximum size of a cookie cannot exceed 4000 characters. Up to 20 cookies can be written per domain.
  • WEBDEV - Server code A single cookie can be written per page.
    Reminder: When a user connects to a WEBDEV site, the Web server loads all the cookies associated with the current domain..
    Note: The Internet domain is a specific part of the Internet address: http://machine.domaine.com/MesPages/Index.html.

Miscellaneous

  • Some browsers give you the ability to disable the cookies. In this case, CookieWrite has no effect.
  • If your cookie name or value contains special characters (e.g.* ), accents or Unicode, writing the cookie may have no effect in some browsers.
Component: wd300page.dll
Minimum version required
  • Version 9
Comments
SameSite=None option not available
We may have a site calling another website with SameSite=None with the secure attribute. This option is not currently available. Alternate method is to override the cookie with javascript to set the attibute
REJISH / BEO
17 Oct. 2022

Last update: 10/17/2024

Send a report | Local help