View Full Version : application/xhtml+xml from a static file
ghell
05-17-2006, 02:45 PM
I was just reading around on the xmlhttp spec and although IE6 doesn't support xhtml at all im guessing ie7 does, firefox and i believe opera already support this mime type and xhtml2.0 requires application/xhtml+xml. So please do not simply reply to tell me it does not work at the moment anyway as I am thinking of when it will work properly.
However when I was reading around I couldn't really find any information about how to give a static page this type.. theres a meta tag but arent those invalid xhtml1.1 or something.. and the header mime type would still be text/html..
ASP, PHP and other Server Side Languages can obviously just write the header but appart from this would it need to be all done from the actual webserver's header config?
What happens for those users who wish to write valid xhtml1.1 or 2 on a server that they have no control over?
Is there any way to give the document this type if you write the file in say notepad/gEdit and upload it to a server which you have no control over the headers on?
KC-Luck
05-17-2006, 04:19 PM
You should post this to a server forum, not really just XML related.
If you are on Apache, there are .conf files or such that can add the headers per extension, so you would save it as .xhtml, and the users browser would respond to that type as well.
But, in IIS you are not able to muck w/ the header/mimeTypes, unless administration allows it. Some hosts will allow you to add mimetypes through an admin control panel for such instances.
ghell
05-17-2006, 06:33 PM
its an xhtml question, i asked how to do it without having access to the server and the description of this forum isTalk about XML and related technologies such as XSL, XHTML here.
i know in apache (and iis btw) you can alter the headers and extensions easily but i wanted to know if there was a way of doing it in a file without having access to such things (ive never used a conf file so i don't know if this is what i was asking for but i was looking for a general way to do it, for it to be in the specification it has to be able to run it standalone etc anyway)
_Aerospace_Eng_
05-17-2006, 06:43 PM
Read this post. http://www.codingforums.com/showpost.php?p=445540&postcount=16
It should be what you want. Either way it is STILL a server side question.
XHTML 1.1 actually requires to be served as application/xhtml+xml (or any other XML mime-type).
Locally, browsers like Firefox and Opera tend to associate themselves to .xhtml files. On a server though, most setups by default don't include an entry for XHTML. Just fireup a text-editor and type:
AddType application/xhtml+xml .xhtml
Save it as .htaccess, and upload to your root directory (if you're using Apache). Then globally on your server, .xhtml is mapped to application/xhtml+xml.
ghell
05-18-2006, 08:17 AM
Read this post. http://www.codingforums.com/showpost.php?p=445540&postcount=16
It should be what you want. Either way it is STILL a server side question.It is NOT a serverside question when I knew all these ways to do it from SSL or the webserver but was asking if there was some common way of doing it from the files and NOT from the server!!! That was the whole point in the question!!
I will have to do some network tests with .xhtml on the latest servers to get an answer I suppose. If browsers currently have .xhtml commonly associated for it it shouldn't be long before servers change to match, although i dont know if that's a standard or anything yet.
I'm still sure that there must be some global trick to do this but most people arent familiar with it or they would not have introduced it as a standard. (For example it seems almost no broadcast systems such as shoutcast even realise that .m3u will play on any player as it is a standard universal playlist so they make different links for winamp, real, itunes, wmp etc.)
Also a reminder that there are webservers out there that arent apache or iis (for example there are at least 100 python webservers as they are so easy to make but there are also other webservers that only support loading files and sending them to the client rather than any SSL etc.)
_Aerospace_Eng_
05-18-2006, 08:42 AM
It requires a server side language for it to be done hence why this is a server side question. Did you even read the link post?
ghell
05-18-2006, 08:46 AM
Yes did you ever read me writing "ASP, PHP and other SSLs can obviously just write the header but appart from this would it need to be all done from the actual webserver's header config?" before giving me a php script which I already knew how to do.. the whole question was doing it without SSL
_Aerospace_Eng_
05-18-2006, 09:56 AM
It doesn't need SSL. Its that one php file in the post. Thats it and then an include line and a function call line. You just need to upload a file. I don't see where you are going with this. IE doesn't know what application/xhtml+xml is so if you gave it the header type without any type of checking it would try to download the file. You seem to be making this harder than it has to be. The script in that post doesn't require that you edit ANYTHING in the server configuration. Are you not allowed to use php or something? If thats the case then I really see no other way to do this without a server side language.
not sure but i think ghell was using "SSL" as "server side language" and perhaps Aero picked it up as "Secure Sockets Layer" at first?
ghell
05-18-2006, 11:55 AM
Oh sorry yea acronym clash but i did say asp, php and other ssls (meaning that asp and php were ssls) I'll edit my original question.
I was refering to servers that only allow html files (as binary files such as .jpg or .zip) not server side languages, and that you cannot change the webserver configuration for (i was mainly hoping for some standard way of doing it that works on all the servers, a standard supported association for example all webservers use text/html for .htm and .html pages automatically (although xhtml is not supported in ie6 i mean supported by webservers that follow standards) or a file you can put in the same directory as another file on any webserver to get it to work or whatever. (not sure if this is what the .conf was, .htaccess only works in apache, web.config only works for asp.net etc)
w3 talks about it being impossible to determine from the document itself but doesnt give any better way of forcing the mime type and if it is saying that they are required then there must be some way of doing it in general other than using explicit global server configuration or server side languages. Using server side languages where they are not needed can lead to complications such as losing a file system maintained last-modified date for the headers (which has cache issues, especially in ajax) etc but this is not the reason for me asking I just wanted to know if there was a general way to do it without using explicit server config or a server side language.
On a side note from "It doesn't need SSL. Its that one php file in the post" it looks like he read it as SSI anyway (server side includes)
Excuse me if I got a little frustrated earlier I just had an exam (between my last post and now) and its not nice being patronised especially when I specifically asked not for a server side language or server config solution and the answer I got was telling me that I should have posted in the server forums when it is clearly a xhtml standards issue..
KC-Luck
05-18-2006, 03:53 PM
AND the consensus AT THIS FORUM is ...
it requires SERVER SIDE LANGUAGE, or APACHE .htaccess file, or WEB.CONFIG.
There are no other ways to force the mimeType to the browser.
Why do you require the application/xhtml+xml anyways?
It is not supported by all browsers, even IE7 can not parse it as such??
If you use the .xml extension, surely you'll be closer to the final results, or name it .xhtml and get your HOST to config your SERVER, because you know nothing about SERVER administrations. :)
_Aerospace_Eng_
05-18-2006, 06:56 PM
Yeah see I read it at Secure Socket Layers not Server Side languages. It helps when terminology is correct.
KC-Luck
05-18-2006, 08:12 PM
<-- never even heard SSL being used as anything but Secure Socket Layers? :)
http://en.wikipedia.org/wiki/SSL
Alex Vincent
05-18-2006, 10:40 PM
I'm going to close this thread, on my authority as moderator of XML. Please note that I rarely, if ever, do this, and I may reverse my decision later today. Certainly I need to decide if I'm going to prune posts in here (something else I almost never do).
Ghell, please PM me if you disagree. Also, if a supermod or admin wants to override my decision, I won't object.
To sum up: content-type is controlled by the server, as has been mentioned before. XHTML has a tag called META which may help (see http://www.w3.org/TR/html4/struct/global.html#h-7.4.4.2 for details), but it's largely a hint to the browser, and nothing more.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.