Skip to content

Advanced Setup

On most pages iframe-resizer is able to detect changes in the iframe, recalculate the page size and adjust the iframe in sub nanosecond time. In a few rare edge cases, it might need a little help.

Custom page size

The following three options allow you to adjust how the content size is calculated by targeting which page elements are used in the calculations and then adjusting the returned value.

data-iframe-size

By adding a data-iframe-size attribute to any HTML element on the page, you can tell iframe-resizer to use that element to calculate the page size. Where their is more than one element with the attribute, then the element with the largest value will be used.

sizeSelector

This option can be set via the Child Page API settings and allows you to use a CSS Selector to add the data-iframe-size attribute to elements on the page. When the page content changes, this will be rerun to ensure this setting remains up to date.

offsetSize

Available in both the Parent and Child pages, this option allows you to adjust the calculated page size. It can be provide with a positive or negative value.

Performance

If iframe-resizer gives you a warning about performance, then the first two options above can also be used to limit the total number of page elements that require inspection to calculate the page size. This will greatly improve performance on pages where you have a lot of content that has overflowed the root document element.

Was this page useful?