Use an HTML <iframe> to display an existing webpage inside another webpage. Set its src to the page’s URL, give the frame a descriptive title, and choose dimensions that work in your layout. The destination site must also permit framing; the iframe code alone cannot override its restrictions.
Embed a webpage with an iframe
An <iframe> creates a nested browsing context: the outer page contains a separate document loaded from the URL in the iframe’s src attribute. For a basic example, replace the sample URL with the page you want to display:
As an Amazon Associate I earn from qualifying purchases.
<iframe
src="https://example.com"
title="Example service page"
width="600"
height="400"
loading="lazy">
</iframe>
The example URL and dimensions are illustrative, not required values. Include both the opening and closing iframe tags. The title should briefly describe what the embedded page contains, so people using screen readers can identify the frame without first entering it. MDN’s iframe reference recommends this kind of concise label.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsMake the frame fit the page
The width and height attributes specify dimensions in CSS pixels. CSS can override them. A fluid width is useful when the containing layout changes size:
#1 Best Overall
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
iframe {
display: block;
width: 100%;
max-width: 100%;
border: 0;
}
This makes the iframe element fit its parent’s width, but it does not make the frame automatically match the height of an arbitrary remote page. The embedded document does not normally provide its dimensions to the parent for responsive sizing. Choose a suitable height, or use a sizing arrangement supported by the embedded page.
Check whether the destination allows embedding
A syntactically correct iframe does not guarantee that the destination will appear. The remote site can use security policies that refuse to be displayed in a frame. If the frame is blank or reports that it was refused, check the destination’s current embedding instructions and security policy. The restriction belongs to the site being embedded; changing your page’s CSS will not remove it. MDN’s iframe reference and MDN’s guide to embedded content describe the relevant embedding behavior.
Rank #2
Know what the outer page can control
The iframe is a separate document. CSS on the outer page can style the iframe element—such as its size and border—but does not give the outer page permission to restyle an unrelated website inside it. Likewise, browser same-origin protections restrict scripts from reading or changing a cross-origin document’s contents. If both pages need to exchange data, they must implement a supported communication method such as postMessage().
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Use sandbox restrictions carefully
The sandbox attribute can restrict capabilities available to the embedded page. Add only the permissions the embedded application needs, using individual tokens where appropriate. Restrictions can affect scripts, forms, and popups, so verify required interactions after adding a sandbox.
Rank #3
MDN warns that combining allow-scripts and allow-same-origin for same-origin embedded content can undermine the sandbox. Review the iframe attribute reference before choosing permissions; a broad sandbox is not automatically safer if it breaks the required behavior or is configured to negate its protections.
Defer offscreen frames when appropriate
An iframe loads a separate document environment and adds memory and computing work. For a frame that is initially offscreen, loading="lazy" can defer loading and reduce work during the initial page load. MDN notes that lazy loading applies when JavaScript is enabled. Do not defer a frame that must be immediately visible or usable.
Rank #4
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
When to use another element
For embedding an entire webpage, use <iframe>. The similarly named <object> and <embed> elements serve other embedded-resource use cases; they are not general replacements for an iframe when the goal is to show another web document. See MDN’s embedded content guide for the distinction.
What about adding audio?
Audio is a separate task, not a webpage-embedding method. Use the HTML <audio> element when you want to add playable audio content to a page.
Best Value
Why the older forum answer still needs context
A SitePoint Forums question from July 12, 2016 asked how to embed a webpage and how to add audio. A reply recommended an iframe for the webpage, which remains the right element for embedding a whole document. The thread also contains a dated disagreement about whether <object> replaces an iframe; current MDN guidance distinguishes the elements by their use rather than treating them as interchangeable. The original thread is available at SitePoint Forums.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




