Whitebeam Template Reference Documentation

Site Map
 
Home
 
Application Guide
Reference
  Installation
  Configuration
  XML Markup
  JavaScript Classes
  ROM
  Templates
  Environment
  Dev Process
  Tools
  External Links
  Example libraries
Community
Contact Whitebeam
To-Do
Download
Credits
Licence
Whitebeam Users
 
 
 

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
CookieNamestring  Required. The name of the cookie. This can be any string.
Datastring  Required. The object to be stored in the client side cookie.
Pathstring  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.
Domainstring  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.
expiresstring  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.

Whitebeam release 1.3.36
(loadtime : 64ms)