Delivery Context

1 Introduction

The delivery context (DC) is a collection of client properties, request information, site information and anything else affects the processing of a FIT request.

When a site is requested, FIT uses the HTTP request headers (most importantly User-Agent and X-WAP-Profie) to detect a base set of properties, divided into hardware, OS and browser. This base set is then enriched with information gathered by JavaScript feature detection (e.g. through the Detection Page) and made accessible to the system.

The DC is initialised at the beginning of every request. It is used in Adaptation Instructions, the Flow and Adaptive Components to evaluate conditions. It is also accessible in XSLT via fit://request/dc and in client-side JavaScript.

The set-dc action allows developers to manipulate the DC.

2 Document structure

The delivery context document is an XML document. Its root element is the dc element. Each property is represented by an element. Its XPath relative to the dc element is the same as the property’s path (see below). Some properties are marked as Boolean. If the value is true, the delivery context document contains an element for this property, otherwise there is no element representing the property. Properties marked as String or Number are represented by an element with text content.

Example dc.xml


Accessing the Delivery Context

In JavaScript code:

var el = ...;
function myListener() {
/*!ai-if="js/pointerdown" */
el.addEventListener('/*!ai-insert select="js/pointerdown/name"*/', myListener);

In CSS code:

article {
  /* Delivery Context values for dynamic CSS and fallback: 23px */
  border-radius: /* ai-replace="concat(round(viewport/width div 50),'px;')" */ 23px; /*!ai-end */
  border-width: 2px;
  border-color: red;
  border-style: solid;
  padding: /* ai-replace="concat(round(viewport/width div 50),'px;')"*/23px;/*!ai-end */
  text-align: center;