Iframe

Enables apps to resize their iframes.

Methods

getLocation (callback)

Get the location of the current page of the host product.

Parameters

NameTypeDescription
callback

function

function (location) {...} The callback to pass the location to.

Example

1
2
3
AP.getLocation(function(location){
  alert(location);
});

resize (width, height)

Resize the iframe to a width and height.

Only content within an element with the class ac-content is resized automatically. Content without this identifier is sized according to the body element, and is not dynamically resized. The recommended DOM layout for your app is:

1
2
3
4
5
6
7
8
<div class="ac-content">
    <p>Hello World</p>
    <div id="your-id-here">
        <p>App content goes here</p>
    </div>

    ...this area reserved for the resize sensor divs
</div>

The resize sensor div is added on the iframe's load event. Removing the ac-content element after this, prevents resizing from working correctly.

This method cannot be used in dialogs.

Parameters

NameTypeDescription
width

String

The desired width in pixels or percentage.

height

String

The desired height in pixels or percentage.

Example

1
AP.resize('400','400');

sizeToParent()

Resize the iframe so that it takes up the entire page.

This method is only available for general page modules.

Example

1
AP.sizeToParent();

Rate this page: