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
  • Overview
  • What is stored in a cookie?
  • WEBDEV and the management of cookies
  • Available elements
  • Writing a cookie on the user's computer
  • Reading a cookie on the user's computer (server code and browser code)
  • Checking the management of cookies in a WEBDEV website
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Overview
A cookie is an easy way to temporarily store information on the user's computer. This information can be retrieved later.
When the Web user visits the same site several times, the site "identifies" the user from his cookies. This allows you to avoid requesting details already provided during a previous visit and to propose custom pages.
Note: A cookie has an expiry date (default 30 days after creation). It is automatically destroyed by the user's browser if its lifespan is exceeded.
Usage example of cookies
Cookies can be used to store information on the user's computer, such as the user's name, pages visited, date of last connection, preferences, etc.
This information, saved as cookies, will be read next time the user visits the site. Therefore, the site can propose custom features to the Web user:
  • ad banners based on what users have viewed during their last visit,
  • a custom home page with the username and the date of last connection,
  • display of promotions corresponding to searches carried out during the last visit, etc.
What is stored in a cookie?
A cookie is a text file stored on the user's computer (in the Internet "cache" of the browser) for a given duration. The cookie is created by the browser or by the server.
Each cookie contains the following information:
  • Cookie name: enables the site to identify the cookie
  • Cookie text: information entered by the site (pages consulted, information provided by the user, etc.)
  • Expiration date after which the cookie is not valid anymore.
  • Name of the Internet domain that created the cookie.
    Reminder: the Internet domain is a specific section of Internet address: http://machine.domain.com/MyPages/Index.html.
WEBDEV and the management of cookies

Available elements

Two WLanguage functions can be used to manage the cookies in your sites:
CookieReadRetrieves the value of a cookie saved on the computer of Web user
CookieWriteSends a cookie to the client when the HTML page is displayed in the browser of the Web user
These functions can be used in server code and in browser code.

Writing a cookie on the user's computer

To write a cookie on the computer of the Web user:
In server code:Use CookieWrite and specify the name, content and expiration date of the cookie.
The cookie will be created on the computer of the Web user during the display of next page.
Note A cookie created in server code can be read back using the CookieRead function:
  • immediately if CookieRead is used in a browser code
  • during the next user connection if CookieRead is used in a server code.
In browser code:Use CookieWrite and specify the name, content and expiration date of the cookie.
The cookie is immediately created.

Reading a cookie on the user's computer (server code and browser code)

To read a cookie on the user's computer (server code and browser code), use CookieRead and specify the name of cookie.
Notes When connecting to the website, the server automatically reads all cookies associated with the current domain. CookieRead used:
  • in server code, reads in memory and retrieves the content of specified cookie.
  • in browser code, directly reads the content of the cookie on the computer of the Web user.
Checking the management of cookies in a WEBDEV website
The management of cookies in your site (on the development computer) can be checked:
  • from the test page of WEBDEV administrator.
  • with a simple test by a project "GO" from the page editor of WEBDEV.
Minimum version required
  • Version 9
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help