Get to know MDN better
The currentSrc read-only property of the HTMLImageElement interface indicates the URL of the image selected by the browser to load.
A string indicating the full URL of the image currently selected by the browser to load. If the image uses the srcset attribute, currentSrc lets you determine which image from the set of provided images was selected by the browser. The property's value is unrelated to whether the image has successfully loaded or not.
In this example, two different sizes are provided for an image of a clock. One is 200px wide and the other is 400px wide. The sizes attribute is provided to indicate that the image should be drawn at 50% of the document width if the viewport is under 400px wide; otherwise, the image is drawn at 90% width of the document.
| HTML # dom-img-currentsrc-dev |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Nov 7, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.