|
|
|
|
- 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 site
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. Remark: A cookie has an expiration date (30 days by default). 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, the pages they have visited, the date of their last connection, a backup of their options, 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,
- special offers corresponding to the searches performed during his 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: - 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 the 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: | | CookieRead | Retrieves the value of a cookie saved on the computer of Web user | CookieWrite | Sends 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. Remark: 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, 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. Remarks: 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|