The HTML `<iframe>` element represents an inline frame, which allows you to include an independent HTML document into the current HTML document. The `<iframe>` is typically used for embedding third-party media, your own media, widgets, code snippets, or embedding third-party applets such as payment forms.
### Attributes
Listed below are some of the `<iframe>`'s attributes:
| Attribute | Description |
| --- | --- |
| `allowfullscreen` | Set to true to allow the frame to be placed into full screen mode |
| `frameborder` | Tells the browser to draw a border around the frame (set to 1 by default) |
| `height` | The height of the frame in CSS pixels |
| `name` | A name for the frame |
| `src` | The URL of the web page to embed |
| `width` | The width of the frame in CSS pixels |
The content between the opening and closing `<iframe>` tags is used as alternative text, to be displayed if the viewer's browser does not support iframes.
Any `<a>` link can target the content of an `<iframe>` element. Rather than redirect the browser window to the linked webpage, it will redirect the `<iframe>`. For this to work, the `target` attribute of the `<a>` element must match the `name` attribute of the `<iframe>`.
<p><ahref="https://www.youtube.com/embed/v8kFT4I31es"target="iframe-redir">Redirect the Iframe</a></p>
```
This example will show a blank `<iframe>` initially, but when you click the link above it will redirect the `<iframe>` to show a YouTube video.
### Javascript and Iframes
Documents embedded in an `<iframe>` can run JavaScript within their own context (without affecting the parent webpage) as normal.
Any script interaction between the parent webpage and the content of the embedded `<iframe>` is subject to the same-origin policy. This means that if you load the content of the `<iframe>` from a different domain, the browser will block any attempt to access that content with JavaScript.