SourceMap

SourceMap HTTP 响应头链接生成的代码到一个 source map,使浏览器能够重建原始的资源然后显示在调试器里。

Header 类型 Response header
Forbidden header name no

语法

SourceMap: <url>
X-SourceMap: <url> (deprecated)

指令

<url>
指向一个source map文件的一个相对(于请求的URL)或者一个绝对的URL。

例子

SourceMap: /path/to/file.js.map

规范

Specification Title
Draft document Source Map Revision 3 Proposal

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
SourceMap
Non-standard
Chrome Full support Yes
Full support Yes
Full support Yes
Prefixed
Prefixed Implemented with the vendor prefix: X-
Edge ? Firefox Full support 55
Full support 55
Full support 27
Prefixed
Prefixed Implemented with the vendor prefix: X-
IE ? Opera Full support Yes
Full support Yes
Full support Yes
Prefixed
Prefixed Implemented with the vendor prefix: X-
Safari Full support Yes
Full support Yes
Full support Yes
Prefixed
Prefixed Implemented with the vendor prefix: X-
WebView Android Full support Yes
Full support Yes
Full support Yes
Prefixed
Prefixed Implemented with the vendor prefix: X-
Chrome Android Full support Yes
Full support Yes
Full support Yes
Prefixed
Prefixed Implemented with the vendor prefix: X-
Firefox Android Full support 55
Full support 55
Full support 27
Prefixed
Prefixed Implemented with the vendor prefix: X-
Opera Android Full support Yes
Full support Yes
Full support Yes
Prefixed
Prefixed Implemented with the vendor prefix: X-
Safari iOS Full support Yes
Full support Yes
Full support Yes
Prefixed
Prefixed Implemented with the vendor prefix: X-
Samsung Internet Android Full support Yes
Full support Yes
Full support Yes
Prefixed
Prefixed Implemented with the vendor prefix: X-

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.
Requires a vendor prefix or different name for use.
Requires a vendor prefix or different name for use.

另请参阅