src
The embedded page URL.
Learn src, title, sandbox, allow, loading, referrerpolicy as part of the HTML attribute system: what they configure, where they belong and which mistakes to avoid.
Iframes
An iframe embeds another page inside the current page. That is powerful, but it also creates security, privacy, performance and accessibility concerns.
The most important iframe attributes are not only src. A production iframe needs a useful title and often sandbox, allow, loading and referrerpolicy.
src, title, sandbox, allow, loading, referrerpolicy. Attributes for embedded pages, permissions and isolation. What belongs here
srcThe embedded page URL.
titleAccessible description of what the iframe contains.
sandboxRestricts what the embedded content can do.
allowGrants specific permissions such as fullscreen or clipboard access.
loadingCan lazy load offscreen iframes.
referrerpolicyControls how much referrer information is sent.
Syntax in context
Always describe the iframe with title. Add sandbox when you do not fully control the content.
<iframe src="demo.html" title="Interactive HTML demo" sandbox="allow-scripts" loading="lazy" ></iframe>
Good versus weak
<iframe src="demo.html" title="Interactive HTML demo" sandbox="allow-scripts" loading="lazy" ></iframe>
<iframe src="https://unknown.example/widget"></iframe>
Rules that matter
The title tells assistive technology what the embedded page is.
Start restrictive and only add permissions you need.
Offscreen embeds can be heavy and slow.
allow should not become a random collection of capabilities.
Production thinking
Attributes are small, but they change how an element works. A good attribute can make a link usable, an image understandable, a form easier to complete or a script safer to load.
An iframe without title is hard to understand when navigating with assistive technology.
Third-party iframes can slow pages and create privacy questions. Treat them as dependencies.
Live code lab
Edit the HTML or CSS, then use Run to refresh the preview. The preview is isolated, so links and forms stay inside this practice area.
Mini assignment
Practice assignment
Try it yourself
Self-check
Do not only read this page. Answer these questions out loud or write the answers in your own notes. If one answer feels vague, revisit the examples before moving on.