if the server doesn't send the content-type header, how does the browser tell which kind of content he got? For example, when I get the SO logo with chrome, the image is intact, though the server doesn't state its extension (at least, explicitly)
相关问题
- Angular RxJS mergeMap types
- Google Apps Script: testing doPost() with cURL
- How to instantiate Http service in main.ts manuall
- C#使用http访问网络,有办法用指定网卡访问网络嘛?
- PHP Empty $_POST
相关文章
- C#使用http访问网络,有办法用指定网卡访问网络嘛?
- Is a unicode user agent legal inside an HTTP heade
- git: retry if http request failed
- Flutter - http.get fails on macos build target: Co
- C# HttpClient.SendAsync always returns 404 but URL
- Response body is null, status is 200
- Returning plain text or other arbitary file in ASP
- jquery how to get the status message returned by a
It can guess the content type by inspecting the file.
For example, PNG have "PNG" among the first 4 bytes.
Most browsers do content sniffing if the type is not explicitly declared in the HTTP header. They are looking for specific signatures they know and thereby guess the media type.
See the section Determining the type of a new resource in a browsing context in the HTML 5 specification or this Draft of Content-Type Processing Model for some examples.
Different browsers handle it in different ways.
Internet Explorer guesses based on content. In fact has often ignored
Content-Type
headers, instead using its own guess.Some browsers also take the extension into account.