0Pricing
HTML Academy · Lesson

The iframe Element src and sandbox

Embed third-party pages and restrict their capabilities.

What is an iframe?

The <iframe> element embeds another HTML document within the current page. Each iframe has its own browsing context, DOM, and JavaScript scope. Content inside an iframe cannot access the parent page's DOM without explicit permission.

Basic iframe Usage

Set the src attribute to the URL to embed: <iframe src="https://example.com" width="800" height="600">. The iframe creates a new browsing context. Title attribute is required for accessibility: title="Embedded map".

All lessons in this course

  1. The iframe Element src and sandbox
  2. iframe Security Clickjacking and X-Frame-Options
  3. The embed and object Elements
  4. Lazy Loading iframes
← Back to HTML Academy