file suffixes have always been an auxiliary means of distinguishing file types.
many types have specific binary headers, such as JPEG , in which case even if you name it .gif
, the picture viewer knows that it is a JPEG .
and some types do not have a specific binary header or do not open the binary header format is known to the world, then it can only be based on the suffix of the file name, in this case, you use a non-dedicated file viewer to view, the effect is not guaranteed.
these are local browsing of files, while browsers recognize server files differently.
browsers want to know the actual type of a server-side file, mainly relying on the value declared in the Content-Type
response header of the file stream. You can learn about the common MIME
types through .
but this response header just tells the browser what type of file I sent you, not necessarily whether it is really this type or not. This goes back to the beginning: if there is a binary header, the header shall prevail; if not, the declaration of the file provider ( Content-Type | MIME
, suffix) shall prevail.
browsers determine the type of your content based on content-type
, not on the suffix
you seem to say