tags:

views:

157

answers:

3

Can someone tell me method to define the MIME-Type of a static XHTML File as text/html …. I don’t want to use php, asp.net…….. javascript would be ok

A: 

Use your web server to do it. If you are using apache, create a file called .htaccess in the directory with the file and add this line:

AddType text/html .html

Rich Bradshaw
A: 

I´m using tomecat

+4  A: 

You shouldn't. Here's why:

Sending XHTML as text/html Considered Harmful (http://hixie.ch/advocacy/xhtml)

If you use XHTML, you should deliver it with the application/xhtml+xml MIME type. If you do not do so, you should use HTML4 instead of XHTML. The alternative, using XHTML but delivering it as text/html, causes numerous problems that are outlined below.

jakber
This text is also considered harmful. It's complete drivel, actually. Good in theory, useless in practice. In practice, XHTML 1.0 Strict delivered as text/html works problem-free.
Konrad Rudolph
Here are some rebuttals: http://h3h.net/2005/12/xhtml-harmful-to-feelings/ and http://blog.deconcept.com/2004/11/03/why-its-ok-to-send-xhtml-as-text-html/
Konrad Rudolph
Sure, it can be made to work in practice, but the point is that it harms web standards by treating what should be an XML dialect as tag soup in most user agent. So it might not be bad for you, but it could harm the web as a whole. Better to stick with HTML in that case, imho.
jakber
@Konrad: it works problem-free only if you're not using XML serializer and not using any of the new XHTML features. And then you get high risk of ridiculous situation when you've got document labelled as XHTML that doesn't work in XHTML mode (due to ill-formedness, HTML DOM)
porneL