Get to know MDN better
Esta página ha sido traducida del inglés por la comunidad. Aprende más y únete a la comunidad de MDN Web Docs.
This feature is well established and works across many devices and browser versions. It’s been available across browsers since julio de 2015.
* Some parts of this feature may have varying levels of support.
El elemento HTML <iframe> (de inline frame) representa un contexto de navegación anidado, el cual permite incrustrar otra página HTML en la página actual.
Cada elemento <iframe> tiene su propio historial de sesión y su propio objeto Documento. El contexto de navegación que incluye el contenido implícito se llama contexto de navegación principal. El contexto de navegación de nivel superior (que no tiene padre) es típicamente la ventana del navegador, representado por el objeto Window.
Advertencia: Debido a que cada contexto de navegación es un entorno de documento completo, cada <iframe> en una página requiere más memoria y otros recursos informáticos. Aunque teóricamente puede utilizar tantos <iframe> como desee, compruebe si hay problemas de rendimiento.
| Contenido dinámico, contenido textual o estático, contenido incrustado, contenido interactivo, contenido tangible. |
| Contenido alternativo que normalmente no se renderiza para los navegadores que no son compatibles con el elemento <iframe>. |
| Ninguna, tanto la etiqueta inicial como la final son obligatorias. |
| Cualquier elemento que acepte contenido incrustado. |
| application, document, img |
| HTMLIFrameElement |
Este elemento admite atributos globales.
Especifíca una política de características para el <iframe>. Vea el articulo Privacy, permissions, and information security para detalles en temas de seguridad y como <iframe> funciona con las Politicas de Herramientas para mantener los sistemas seguros.
allowfullscreenDefinido como true si el <iframe> puede activar el modo a pantalla completa llamando al método requestFullscreen().
Nota: Se considera un atributo heredado y se redefine como allow="fullscreen".
Definido como true si se debe permitir que un <iframe> de origen cruzado pueda invocar el API de solicitud de pago. <
Nota: Se considera un atributo heredado y se redefine como allow="payment".
Una Politica de Seguridad del Contenido aplicada para el recurso incrustado. Vea HTMLIFrameElement.csp para detalles.
heightIndica la altura del frame en HTML5 en píxeles CSS, o en HTML4.01 en píxeles o como un porcentaje.
importanceLa prioridad de descarga en el recurso para el atributo src del <iframe>. Valores permitidos:
Nombre objetivo para el contexto de navegación incrustado. Se puede utilizar:
Indicates which referrer to send when fetching the frame's resource:
Applies extra restrictions to the content in the frame. The value of the attribute can either be empty to apply all restrictions, or space-separated tokens to lift particular restrictions:
Nota:
This Boolean attribute indicates that the browser should render the inline frame in a way that makes it appear to be part of the containing document, for example by applying CSS styles that apply to the <iframe> to the contained document before styles specified in that document, and by opening links in the contained documents in the parent browsing context (unless another setting prevents this).
srcThe URL of the page to embed.
srcdocThe content of the page that the embedded context is to contain.
widthIndicates the width of the frame in HTML5 in CSS pixels, or in HTML4.01 in pixels or as a percentage.
Estos atributos están obsoletos y es posible que ya no sean compatibles con todos los agentes de usuario. No debe utilizarlos en contenido nuevo y tratar de eliminarlos del contenido existente.
alignLa alineación de este elemento con respecto al contexto que lo rodea.
frameborderEl valor 1 (por defecto) indica al navegador establecer una frontera entre este marco y todo otro marco. El valor 0 indica que el navegador no establece una frontera entre este marco y otros marcos.
longdescUna URI de una descripción larga del marco. Debido al mal uso generalizado, esto no es útil para navegadores no visuales.
marginheightLa cantidad de espacio en píxeles entre el contenido del marco y sus márgenes superior e inferior.
marginwidthLa cantidad de espacio en píxeles entre el contenido del marco y sus márgenes izquierdo y derecho.
scrollingIndica cuándo el navegador debe proporcionar una barra de desplazamiento para el marco:
Nota: See Error 1318532 en Firefox for exposing this to WebExtensions in Firefox.
Makes the <iframe> act like a top-level browser window. See Browser API for details. Available only to WebExtensions.
mozallowfullscreenIn Gecko 9.0 or later, this attribute can be set to true if the frame is allowed to be placed into full screen mode by calling its element.mozRequestFullScreen() method. If this isn't set, the element can't be placed into full screen mode.
webkitallowfullscreenIn Chrome 17 or later (and maybe earlier), this attribute can be set to true if the frame is allowed to be placed into full screen mode by calling its element.webkitRequestFullScreen() method. If this isn't set, the element can't be placed into full screen mode.
mozappFor frames hosting an open web app, this specifies the URL of the app manifest. This ensures that the app is loaded with the right permissions. See Using the Browser API for details. Available in Gecko 13.0 and later.
remoteLoad the frame's page in a separate content process.
Inline frames, like <frame> elements, are included in the window.frames pseudo-array.
With the DOM HTMLIFrameElement object, scripts can access the window object of the framed resource via the contentWindow property. The contentDocument property refers to the document inside the <iframe>, same as contentWindow.document.
From the inside of a frame, a script can get a reference to its parent window with window.parent.
Script access to a frame's content is subject to the same-origin policy. Scripts cannot access most properties in other window objects if the script was loaded from a different origin, including scripts inside a frame accessing the frame's parent. Cross-origin communication can be achieved using Window.postMessage().
Un <iframe> en acción. Después de crear el marco, cuando el usuario hace clic en un botón, su título se muestra en una alerta.
En este ejemplo, se muestra un mapa de Google en un marco.
| HTML # the-iframe-element |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 10 abr 2026 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.