Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do we set the content type header for a local file?

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

Say i have a .xml file that i would like to open as application/xml in google-chrome. how do i specify it?

Now i want to open that same file under text/xml with google-chrome is that an option?

My file:

<?xml version="1.0"?>
<test></test>
like image 220
Pacerier Avatar asked Jun 06 '11 09:06

Pacerier


2 Answers

Headers are only sent to and served by servers. Without a server, there is no such thing as a request, or a 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 a localhost server setup. IIS and Apache (and many others) will run on your local development box, no problem.

like image 152
Jordan Avatar answered Sep 20 '22 02:09

Jordan


No, you can't. HTTP header exists only if it's a HTTP request or response. AFAIK, you can't set more than 1 association to a single file type in your web browser.

like image 36
shinkou Avatar answered Sep 18 '22 02:09

shinkou