Newer Version Available

This content describes an older version of this product. View Latest

apex:iframe

A component that creates an inline frame within a Visualforce page. A frame allows you to keep some information visible while other information is scrolled or replaced.

This component supports HTML pass-through attributes using the "html-" prefix. Pass-through attributes are attached to the generated <iframe> tag.

External websites included in Salesforce use iframes, which restrict features that can track users. Depending on browser settings, the external website may not be able to receive or write third-party cookies in callouts to its own APIs and Salesforce APIs, or use local storage.

Note

Example

1<apex:iframe src="https://salesforce.com" scrolling="true" id="theIframe"/>

The previous example renders the following HTML:

1<iframe height="600px" id="theIframe" name="theIframe" src="https://salesforce.com" width="100%"></iframe>

Attributes

Attribute Name Attribute Type Description Required? API Version Access
frameborder Boolean A Boolean value that specifies whether a border should surround the inline frame. If not specified, this value defaults to false. 10.0 global
height String The height of the inline frame, expressed either as a percentage of the total available vertical space (for example height="50%"), or as the number of pixels (for example, height="300px"). If not specified, this value defaults to 600px. 10.0 global
id String An identifier that allows the inline frame component to be referenced by other components in the page. 10.0 global
rendered Boolean A Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true. 10.0 global
scrolling Boolean A Boolean value that specifies whether the inline frame can be scrolled. If not specified, this value defaults to true. 10.0 global
src String The URL that specifies the initial contents of the inline frame. This URL can either be an external website, or another page in the application. For example, to render the static resource MyAsset on a separate domain from Visualforce:
1<apex:iframe src="{$IFrameResource.MyAsset}" scrolling="true" id="theIframe"/>
10.0 global
title String The text to display as a tooltip when the user's mouse pointer hovers over this component. 10.0 global
width String The width of the inline frame, expressed either as a percentage of the total available horizontal space (for example width="80%"), or as the number of pixels (for example, width="600px"). 10.0 global