开发者

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

开发者 https://www.devze.com 2023-03-11 12:33 出处:网络
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)

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>


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号