View Processors

View processors are powerful HTML attributes you can add to any HTML element in your iAd to dramatically simplify interactions between your HTML content and your ad’s view controllers.

data-ad-outlet

The data-ad-outlet HTML attribute provides an element’s view controller with a reference to the element. All of a view controller’s outlets are accessible from the view controller’s outlets property. For example, the div element in the example below is accessible from outlets.myDiv.

Example

<div data-ad-outlet="myDiv"></div>

Availability

Available in iAd JS 1.1 and later.

data-ad-action

The data-ad-action HTML attribute registers a callback with an element’s view controller. User interaction with the element automatically triggers the callback. The view controller simply needs to the implement the callback. For example, the div element in the example below registers the performAction callback with its view controller.

You should not register a callback to handle transitions to other view controllers; use the data-ad-transitions-to HTML attribute instead.

Example

<div data-ad-outlet="performAction"></div>

Availability

Available in iAd JS 1.1 and later.

data-ad-transitions-to

The data-ad-transitions-to HTML attribute sets up a transition to another view controller that occurs when a user interacts with an element. The value you provide is the value of the view controller’s id property. For example, the div element in the example below sets up a transition to the map view controller.

Example

<div data-ad-transitions-to="map"></div>

Availability

Available in iAd JS 1.1 and later.