Embedding External Content

The <iframe> element embeds another browsing context inside a page. Common uses include maps, videos, and trusted external applications. When embedding untrusted content, use security controls such as sandbox where appropriate.

Sandboxed iframe
<iframe\n  src="https://example.com/widget"\n  title="Example widget"\n  sandbox="allow-scripts">\n</iframe>
💡 The iframe embeds another document. The title helps identify it to assistive technologies and sandbox can restrict capabilities.
Key Takeaways
  • Give iframes meaningful titles.
  • Consider sandboxing when embedding content from external or untrusted sources.
Knowledge Check

Which attribute describes an iframe to assistive technology?