--- title: Iframes --- ## Iframes The HTML `` element represents an inline frame, which allows you to include an independent HTML document into the current HTML document. The `` 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 ``'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 | ### Examples Embedding a YouTube video with an ``: ```html ``` Embedding Google Maps with an ``: ```html ``` ### Alternative Text The content between the opening and closing `` tags is used as alternative text, to be displayed if the viewer's browser does not support iframes. ```html Your browser does not support iframes. ``` ### Targeting an Iframe in a Link Any `` link can target the content of an `` element. Rather than redirect the browser window to the linked webpage, it will redirect the ``. For this to work, the `target` attribute of the `` element must match the `name` attribute of the ``. ```html Redirect the Iframe ``` This example will show a blank `` initially, but when you click the link above it will redirect the `` to show a YouTube video. ### Javascript and Iframes Documents embedded in an `` 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 `` is subject to the same-origin policy. This means that if you load the content of the `` from a different domain, the browser will block any attempt to access that content with JavaScript. ### More Information: See the [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe).
Your browser does not support iframes.
Redirect the Iframe