iframe

iframe embeds an HTML page or document into the current page.

XML Element

iframe

Java Class

IFrame

Basics

The following example demonstrates basic iframe usage.

<iframe width="100%" height="100%" css="border: unset;"
        resource="https://en.wikipedia.org/wiki/Parrot"/>

Displaying Documents

Set resource to the application path of a static document. The example embeds a PDF served from the application’s resources:

<layout>
    <iframe width="100%" height="100%" css="border: unset;"
            resource="pdf/tutorial.pdf"/>
</layout>

Related samples demonstrate documents produced dynamically or loaded through REST:

Inline HTML Content

Set resourceDoc to escaped HTML markup when the frame should render content supplied directly by the view descriptor:

<iframe resourceDoc="&lt;h1&gt;Awesome!&lt;h1/&gt;"/>

Attributes

Common attributes serve the same purpose for all components. The following attributes are specific to iframe:

Name Description Default

allow

Sets a Permissions Policy for features available to the embedded content.

importance

Tells the browser how critical the resource is for rendering the page: AUTO, HIGH, or LOW.

AUTO

name

Sets the name of the embedded browsing context, which can be used as a link or form target.

resource

Specifies the path to the static resource such as resource="pdf/tutorial.pdf" or site URL.

resourceDoc

Sets escaped inline HTML content. See Inline HTML Content.

sandbox

Restricts capabilities of the embedded content. Specify comma-separated SandboxType values such as RESTRICT_ALL or ALLOW_SCRIPTS. When omitted, no sandbox restrictions are applied.

Handlers

Name Description

AttachEvent

Fires when the frame is attached to the UI.

DetachEvent

Fires when the frame is detached from the UI.