HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In
GitHubNuGetDev CommunityDoc feedback


This legacy content applies to Optimizely Content Management System (CMS) versions 10 and 11.

## IFrameComponent

To create an `IFrameComponent`, add the `IFrameComponent` attribute to the class as follows:


The `IFrameComponent` attribute is extendable so that you can add additional functionality if needed.

The `IFrameComponent` has some required and optional parameters as follows:

  • `Url` (required) – The URL to the source. This is the original URL that is loaded into the `iFrame` when it is initialized.

  • `ReloadOnContextChange` (optional) – Default value is true. When set to true, the `iFrame` is reloaded when the context is changed. The component will add context-specific query parameters to the `SourceUrl` attribute (see above). The parameters added are uri and id.

  • `KeepUrlOnContextChange` (optional) – Default value is false. When set to true, the component keeps the currently loaded URL when reloading the `iFrame`, otherwise it reloads the original URL every time the context is changed.

  • `MinHeight` (optional) – Default value is 100. The minimum height of the `iFrame`.

  • `MaxHeight` (optional) – Default value is 500. The maximum height of the `iFrame`.

## Context awareness

The component keeps track of context changes for times that you need to know when the user has changed the page in the page tree. The component reloads the `iFrame` (when `ReloadOnContextChange` is set to true) and sets query parameters with information about the context. The following parameters are set:

  • `uri` – The key uniquely identifying the entity in context, for example, epi.cms.pagedata:///3\_177.

  • `id` – The id of the page in the context to be used by the `PageBase` class to load the current page.

## Change the IFrameComponent properties in client code

Sometimes the requirements of a web form change after initialization (such as a reload on context changes). The following example shows how the properties of the `IFrameComponent`Β are changed from within the `iFrame`: