HTML Iframe - 11 Attributes (Reference)

Tech:
Html
Since:
1 year ago
Views:
5

The iframe tag is used to embed another HTML page into the current page. It has a number of attributes that can be used to control the appearance and behavior of the embedded page.

allow

The allow attribute specifies whether the content of the embedded page can be loaded in the current page.

<iframe allow> </iframe>

allowfullscreen

The allowfullscreen attribute specifies whether the embedded page can be displayed in full screen mode.

<iframe allowfullscreen="true"> </iframe>

allowpaymentrequest

The allowpaymentrequest attribute specifies whether the embedded page can be used to initiate payment requests.

<iframe allowpaymentrequest="true"> </iframe>

height

The height attribute specifies the height of the embedded page.

<iframe height="100px"> </iframe>

width

The width attribute specifies the width of the embedded page.

<iframe width="100px"> </iframe>

name

The name attribute specifies the name of the embedded page.

<iframe name="iframeName"> </iframe>

loading

The loading attribute specifies how the embedded page is loaded.

<iframe loading="eager"> </iframe> <iframe loading="lazy"> </iframe>

referrerpolicy

The referrerpolicy attribute specifies the policy to be used when fetching the resource.

<iframe referrerpolicy="no-referrer"> </iframe>
<iframe referrerpolicy="no-referrer-when-downgrade"> </iframe>
<iframe referrerpolicy="origin"> </iframe>
<iframe referrerpolicy="origin-when-cross-origin"> </iframe>
<iframe referrerpolicy="same-origin"> </iframe>
<iframe referrerpolicy="strict-origin-when-cross-origin"> </iframe>
<iframe referrerpolicy="unsafe-url"> </iframe>

sandbox

The sandbox attribute specifies a list of sandboxing features for the embedded page.

<iframe sandbox="allow-forms"> </iframe>
<iframe sandbox="allow-pointer-lock"> </iframe>
<iframe sandbox="allow-popups"> </iframe>
<iframe sandbox="allow-same-origin"> </iframe>
<iframe sandbox="allow-scripts"> </iframe>
<iframe sandbox="allow-top-navigation"> </iframe>

src

The src attribute specifies the URL of the page to be embedded.

<iframe src="sourceLink"> </iframe>

srcdoc

The srcdoc attribute specifies the HTML content of the embedded page.

<iframe srcdoc="<html><head></head><body>Content</body></html>"> </iframe>