<apex: iframe> Component in Visualforce Page

The <apex: iframe> is another important component in the Visualforce page that creates an inline frame within the Visualforce page. It allows users to keep information visible when other information is scrolled or replaced.

The HTML pass-through attributes are supported by this component by using the "html-" prefix.

The <apex: iframe> component has the following attributes:

1. frameborder

The frameborder is a Boolean type attribute used to specify whether a border should surround the inline frame or not. The boolean value true is set as the default value for this attribute.

Syntax

2. height

The height is a string-type attribute used to specify the height of the inline frame. The value can be defined in percentage or pixels. By default, its value is set to 600px.

Syntax

3. id

The id is a string-type attribute, i.e., a unique identifier that allows this component to be referenced by other components on the page.

Syntax

4. rendered

The rendered is a Boolean type attribute that specifies whether this component needs to be rendered on the page or not. The boolean value true is set as the default value for this attribute.

Syntax

5. scrolling

The scrolling is a Boolean type attribute used to specify whether this component needs to be scrolled on the page or not. The boolean value true is set as the default value for this attribute.

Syntax

6. src

The src is a string type attribute, i.e., a URL that specifies the initial contents of the inline frame. We can define a URL either of the external website or another page in the application.

Syntax

7. title

The title is a string-type attribute that defines the text that needs to display as a tooltip when the user's mouse pointer hovers over this component.

Syntax

8. width

The width is a string-type attribute used to specify the width of the inline frame. The value can be defined in percentage or pixels. By default, its value is set to 600px.

Syntax

Let's take an example to understand how we can use the <apex: iframe> component on the Visualforce page.

Output

apex:iframe in Visualforce Page




Latest Courses