Documentation

HDSession

Object representing the client's session. An HDSession object is created automatically and is available as request.session. Information stored in a session will persist on the server across subsequent requests until the session expires.

Sessions expire after 15 minutes of inactivity.

For longer-term storage, consider using an HDDatabase object, or a client cookie.

Object Properties & Methods

 getGet a session value.
 setSet a session value.

get

MethodFirst available in version 1.0.0

Get a session value.

Usage:

session.get(name);

Arguments:

nameThe name of the session variable to return. (string)

Returns the value of the named session variable, or null if no such named session variable exists.

Example:

// Get the value of the session variable named "sessionVariable1":
var value = request.session.get("sessionVariable1");

set

MethodFirst available in version 1.0.0

Set a session value.

Usage:

session.set(name, value);

Arguments:

nameThe name of the session variable to set. (string)
valueThe value to set. Can be a string, number, or JavaScript array/object.

Example:

// Set the value of the session variable 
// named "sessionVariable1" to a string
request.session.set("sessionVariable1", "the value");

// Now set to an array
var a = [1, 2, 3, 4];
request.session.set("sessionVariable1", a);

Copyright © 2010-2017, Handheld Designer, LLC, All Rights Reserved.
Made by hand in New England, USA.