How to set content type header for local file?

how do we set the content type header for a page not served from the server? (i.e. a simple local file saved on the desktop)

Let's say I have a .xml file that I would like to open as application/xml in google-chrome. how to specify it?

Now I want to open the same file under text/xml using google-chrome, what is the option?

My file:

 <?xml version="1.0"?> <test></test> 
+4
source share
2 answers

No, you can’t. An HTTP header exists only if it is an HTTP request or response. AFAIK, you cannot establish more than 1 associations with one file type in your web browser.

+3
source

Headers are sent and served by servers. Without a server, there is no such thing as a request or response, and therefore there will be no content type header to receive.

If you are trying to keep this local, you can open it on the local server. IIS and Apache (and many others) will run in your local development window without any problems.

+5
source

All Articles