hub.eb?material_id=413&track_id=386

JavaScript API: HTTP Session


The httpSession interface represents the client browser session. A HTTP session can contain any number of Form Sessions, these may be spread out across multiple tabs. You can programatically interact with this via the client.httpSession interface.

This interface contains functions that allows you to:

  • get and set HTTP attributes
  • get the session ID
  • invalidate the session

Steps


1

Create a form called first, attach a Before Page script and paste the following code:

client.httpSession.setAttribute("basket", [ "shoes", "t-shirt" ]);
2

Run the first form.

3

Create a form called second and add a table, items, with a name column.

Drag the table onto the page as a Table Control.

Attach a Before Page script and paste the following code:

// Get the basket HTTP attribute
var basket = client.httpSession.getAttribute("basket");

// Add the items in the basket to the items table
basket.forEach(function(item) {
  tables.items.insertRow();
  tables.items.name.value = item;
});
4

Run the second form and notice that the table has been populated with items from the HTTP session attribute.

Current Module

Related