PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • What is a cookie made of?
  • WEBDEV and the management of cookies
  • Available elements
  • Writing a cookie on the computer of the Web user
  • Reading a cookie on the computer of the Web user (server code and browser code)
  • Checking the management of cookies in a WEBDEV site
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
A cookie is an easy way to temporarily store an information on the computer of Web user. 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 expiration date (30 days after its creation by default). It is automatically destroyed by the browser of the Web user when its lifetime is exceeded.
Example for using cookies
A cookie is used to store on the computer of the Web user personal details such as the user name, the pages visited by the user, the date of the last connection, the backup of options, ...
This information, saved in the format of cookies, will be read by the site during the next connection of Web user. Therefore, the site can propose custom features to the Web user:
  • advertising banner related to subjects looked up during the last connection,
  • custom home page with the user name and the date of last connection,
  • special offers corresponding to the searches performed during his last visit, etc.
What is a cookie made of?
A cookie is a text file stored on the computer of the Web user (in the Internet "cache" of the browser) during a specified duration. The cookie is created by the browser or by the server.
Each cookie contains the following information:
  • Name of cookie: used by the site to identify the cookie
  • Text of cookie: information stored by the site (visited pages, personal details supplied by the Web user, ...)
  • Expiration date after which the cookie is not valid anymore.
  • Name of Internet domain that created the cookie.
    Reminder: The Internet domain corresponds to a specific section of the Internet address: http://computer.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:
CookieWriteSends a cookie to the client when the HTML page is displayed in the browser of the Web user
CookieReadRetrieves the value of a cookie saved on the computer of Web user
These functions can be used in server code and in browser code.

Writing a cookie on the computer of the Web user

To write a cookie on the computer of the Web user:
In server code:Use CookieWrite and specify the name of cookie, its content and its expiration date.
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 again by CookieRead:
  • 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 of cookie, its content and its expiration date.
The cookie is immediately created.

Reading a cookie on the computer of the Web user (server code and browser code)

To read a cookie on the computer of the Web user (server code and browser code), use CookieRead and specify the name of cookie.
Notes: During the connection to the Web site, the server automatically reads all the 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 site
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 required version
  • Version 9
Comments
Click [Add] to post a comment