How does the browser know the content type if no such header is specified?
If the server doesn't send the content type header, how does the browser tell what content it received? For example, when I receive the SO logo with chrome, the image remains intact, although the server does not specify its extension (at least not explicitly)
In most browsers content sniffing unless the type is explicitly declared in the HTTP header. They look for specific captions they know and thus guess the type of media.
See the section Determining the Type of a New Resource in View Context in the HTML 5 Specification or Drafting a Content Type Handling Model for some examples.
He can guess the content type by checking the file.
For example, PNG has "PNG" among the first 4 bytes.
Different browsers handle it differently.
Internet Explorer guesses based on content . In fact, the headlines were often ignored Content-Type
, using their own guesswork instead.
Some browsers also respect the extension.