Headers: SourceMap
SourceMap header
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
The HTTP SourceMap response header provides the location of a source map for the resource.
The HTTP SourceMap header has precedence over a source annotation (sourceMappingURL=path-to-map.js.map), and if both are present, the header URL is used to resolve the source map file.
| Header type | Response header |
|---|
Syntax
SourceMap: <url> X-SourceMap: <url> (deprecated)
Directives
<url>-
A relative (to the request URL) or absolute URL pointing to a source map file.
Examples
>Linking to a source map using the SourceMap header
The following response contains an absolute path in the SourceMap header.
HTTP/1.1 200 OK Content-Type: text/javascript SourceMap: /path/to/file.js.map <optimized-javascript>
Developer tools use the source map to reconstruct the original source from the optimized JavaScript returned in the response, allowing developers to debug the original code rather than the format that has been optimized for sending.
Specifications
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
SourceMap |
18 | 79 | 5527 | 15 | 76 | 18 | 5527 | 14 | 76 | 1.0 | 4.4 | 76 |
See also
- Source map
- Firefox Developer Tools: using a source map
- What are source maps? on web.dev (2023)
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/SourceMap