Adding a picture or video is the easy part. Making it load efficiently and understandable to every visitor is the real goal.
What You Need to Know
An embedded map can help visitors find a place, but loading it may contact an external provider and share network information. A regular address and map link are useful alternatives.
Try the Example
Take a look at the example. We’ll explain the important lines right below it.
<main>
<h1>Visit the community museum</h1>
<address>24 Market Street</address>
<p>The address is readable without loading the map.</p>
<iframe src="/embeds/museum-map.html" title="Map of the museum"
loading="lazy" referrerpolicy="no-referrer" width="640" height="400"></iframe>
</main>
Let’s Read the Code
- <main>: The main element marks the primary page content.
- <h1>: A top-level heading explains what the page is about.
- src: Src identifies a resource path for images, frames, or media.
- loading: Loading can ask the browser to defer a resource that is off screen.
What the example shows: The address stays available in plain text while the optional map is loaded in an iframe.
What Happens in the Browser?
The paths shown here refer to files in your own example project. Put real images and recordings in those locations before expecting them to load.
Remember the boundary. Embedded content may be a separate document, sometimes provided by another company. Give it a readable title or alternative, and check what permissions and information its request may expose.
Your Turn
Disable the map and check whether the visitor can still find the museum.
Common Beginner Mistakes
- Leaving out real media files or understandable text alternatives.
- Third-party maps can involve data-sharing and network requests; consider a consent-first approach if necessary.
Key Takeaways
- An embedded map can help visitors find a place, but loading it may contact an external provider and share network information.
- <main>: The main element marks the primary page content.
- Test the behavior you expect rather than trusting how the snippet looks in your editor.