src
The src attribute specifies the URL of an external resource to embed, such as an image, script, or media file.
Syntax
src="url" Examples
<img src="/logo.svg" alt="Logo">
<script src="/app.js"></script>
<iframe src="https://example.com"></iframe>
Output
Loads and embeds the logo, the script, and the framed page from their URLs.
Notes
Unlike href, src embeds the resource into the document. A missing or broken src triggers the error event; for <img> the alt text is shown instead.
Browser & runtime support
| Environment | Since version |
|---|---|
| chrome | 1.0 |
| firefox | 1.0 |
| safari | 1.0 |
| edge | 12 |