|
Whitebeam Template Reference Documentation
|
System Template
cookie.write()
Write a cookie to the clients browser.
Syntax
void = rb.page.cookie.write(CookieName, Data, Path, Domain, expires)
Parameters
The 'cookie.write' method takes 5 parameters:
Name | Type/Value | Range/Length | Description | CookieName | string | | Required.
The name of the cookie. This can be any string.
| Data | string | | Required.
The object to be stored in the client side cookie.
| Path | string | | Optional, default = /
The client will present the cookie back to the server for any request to the same server
and provided the request is for a resource under the subtree specified by the 'path' parameter.
By default to path is the root of the virtual server, causing the browser to return the cookie to all
pages in the same server.
| Domain | string | | Required.
By default the browser will return the cookie to requests within the domain of the request
that created the cookie. This can be narrowed to a sub-domain using this parameter. For
example - suppose the domain for the original page is 'redbourne.com', this parameter
can specify 'test.redbourne.com' as the domain. Note though that the browser will
ignore attempts to set this parameter to a completely different domain.
| expires | string | | Optional, default = Max-Age=86400
The browser will store a cookie for a limited amount of time. The Whitebeam System be default
sets this value to 24 hours (Max-Age=86400 seconds). You can override this by specifying a date
in the standard cookie format (the JavaScript standard date.toGMTString() can be used).
|
Results
The 'cookie.write' method returns no useful information.
Remarks This method allows the Pattern Page to attempt to place a cookie
in the client applications. All but the first two parameters are optional.
There is no gaurantee that the client will accept the cookie. For a discussion of
cookies versus other similar mechanisms see the tutorial on
Session Data. Some reasons why
a browser may not accept a cookies are:
- Cookies turned off at the browser end.
- Written too many cookies to the browser - the client is not required to store more than
a limited number of cookies or a limited amount of data.
|
|
(loadtime : 72ms) |