LogWeb V3 Default Emulator (AJAX based)

Class lw.Cookie

Object
   |
   +--lw.Cookie

class lw.Cookie


Some Cookie background information:

Cookie limitations: Web browsers are not required to retain more than The lw.Cookie library takes care of these specifics with a JavaScript oriented interface: The following code shows a sample use of the lw.Cookie class.
// Load all cookies that are visible for this web page.
var cookies = lw.Cookie.load();		// may return an empty object: { }

// Since we're using the default path, our cookie will be accessible
// to all web pages in the same directory as this file or "below" it.
// Therefore, it choose a cookie name that is unique among those pages:
// "visitor_name_count".
var visitor = cookies.visitor_name_count;	// may be null

// First, try to read data stored in the cookie.
// If the cookie is not defined,
// or if it doesn't contain the data we need,
// then query the user for that data.
if (!visitor) { visitor = { }; }
if (!visitor.name) {
	visitor.name = prompt("What is your name:", "");
	visitor.visits = 0;
}

// Keep track of how many times this user has visited the page:
visitor.visits++;

// Store our cookie values, even if they were already stored:
// we want to reset the expiration date to 10 days from this most recent visit,
// and we want to save the updated visits state variable.
lw.Cookie.store(visitor, "visitor_name_count", 10 * 24)

// Now we can use the state variables of our cookie:
alert('Welcome, ' + visitor.name + '!' +
			   'You have visited this site ' + visitor.visits + ' times.');

// to remove the cookie on user's choice,
// you could define an event handler for a HTML button, such as
// onclick="lw.Cookie.remove('visitor_name_count')"
 

Defined in lwcookie.js


Constructor Summary
lw.Cookie ()
            Declares the lw.Cookie library.
 
Method Summary
<static> string get(<document> document)
           Loads all cookie(s) for the specified document as a string.
<static> Object load(<document> document)
           Loads all cookie(s) for the specified document into an object.
<static> void remove(<String> name, <Document> doc, <String> path, <String> domain)
           Removes the Cookie from the browser.
<static> void set(<String> name, <String> value, <int> hours, <Document> document, <String> path, <String> domain, <boolean> secure)
           Stores a Cookie.
<static> void store(<Object> obj, <String> name, <int> hours, <Document> doc, <String> path, <String> domain, <boolean> secure)
           Stores a property of an object as a Cookie.

Constructor Detail

lw.Cookie

lw.Cookie()

Method Detail

get

<static> string get(<document> document)

load

<static> Object load(<document> document)

remove

<static> void remove(<String> name, <Document> doc, <String> path, <String> domain)

set

<static> void set(<String> name, <String> value, <int> hours, <Document> document, <String> path, <String> domain, <boolean> secure)

store

<static> void store(<Object> obj, <String> name, <int> hours, <Document> doc, <String> path, <String> domain, <boolean> secure)

LogWeb V3 Default Emulator (AJAX based)

Copyright © 2006-2012 by Logics Software GmbH
Documentation generated by JSDoc on Mon Mar 3 17:24:18 2014