Skip to content
Related Articles

Related Articles

Improve Article
HTTP headers | SourceMap
  • Last Updated : 19 Nov, 2019

The HTTP SourceMap header is a response-type header used to map original source from the transformed source. For example, the Javascript resources are transformed to some other source from its original by the browsers at the time of execution. In the process of debugging, it is too difficult to debug a transformed source. On the other hand, the original source can be easily debugged. Hence, the SourceMap header is used to obtain the original source. SourceMap header enables the browser to reconstruct the original source from the transformed source and present it in the debugger. It links the generated code with the source code.

Syntax:

SourceMap: <url>

Directives: The HTTP SourceMap header accepts a single directive mentioned above and described below:

  • <url>: This directive represents the location of the SourceMap file for which the original file is to be obtained.

Example:

  • In this example, the URL mentioned points to the SourceMap file i.e, the transformed source whose reconstructed original source is to be obtained.
    SourceMap: /geeks/gfg/file.js.map
  • This example, you may not see because this X-SourceMap is deprecated, the URL mentioned points to the SourceMap file i.e, the transformed source whose reconstructed original source is to be obtained.
    X-SourceMap: /geeks/g4g/main.js.map

Supported Browsers: The browsers are compatible with the HTTP SourceMap Header are listed below:

  • Google Chrome
  • Firefox
  • Opera
  • Safari
My Personal Notes arrow_drop_up
Recommended Articles
Page :