Zooiblog

Search the Zooiblog

Follow the discussion below and participate.

Support this site.

XHTML vs. HTML Redux

Following up my first post on this subject, I have rethought my statement, and think I’ve come to a solid conclusion.

Writing your sites in HTML is passé, just because XHTML is the future. So are XML and XSL. But choosing XHTML requires some knowledge and a lot of rethinking. You may code a client’s site in XHTML 1.1, everything perfectly valid, except for the MIME-type. So you add a correct MIME-type. Your site may still validate, and may even be correct xhtml+xml protocol. Now, on to the very likely to happen disaster. A client may want to have other content on his page. Hiring you again is something he doesn’t want for such a small thing, so he asks a corporate code monkey. The code monkey starts writing his code, perfectly copied from FrontPage 2003, everything in order, nothing to worry about. Upload. “Yellow Screen of Death”. The client gets angry. It should have worked.

This is what Ben de Groot warned me about (indirectly). A client may love the buzzword XHTML and eXtensibility, but in fact the client can’t even edit his own pages unless he’s crafty with X(HT)ML. No way to satisfy a client.

Using XHTML 1.1 with a text/html MIME-type is considered harmful. Nevertheless I use it on my own blog? Why? Conformation. That’s a closed book.

But what about serving up XHTML 1.0 as text/html? I believe I read something about this, and it suits me. It still isn’t perfect, but if a FrontPage-savvy codemonkey pasts his code into the page, nothing errors. The client is happy. Of course, I don’t recommend using text/html for XHTML at all, but if you like XHTML, please do it so it causes the least of harm.

Now, using HTML like Mozilla.org does is a good way, but it isn’t eXtensible. Faruk has a nice post on this, which saves me from explaining it all again.

I have just one thing in my head, quite annoying. Writing HTML is bad, writing XHTML without the correct MIME-type is bad too. I’ve tried to serve this blog up as application/xhtml+xml, but it didn’t work, which was quite ashaming. Now, what should I do? Switch back to HTML 4.01, XHTML 1.0 Strict, or toss in another MIME-type and risking faulty pages? I know my XHTML knowledge fails on a certain level, so help me out, will you? Please do.

13 comments

  1. this is a good subject rob, and one that does carry some weight. I think for the most part alot of this can be taken care of in your contract that would state what markup you will be using and making sure the client has a basic understanding in laymans terms of what it means. And as with any project; doctype is something that should be a case by case basis

  2. alot of this can be taken care of in your contract that would state what markup you will be using and making sure the client has a basic understanding in laymans terms of what it means

    Of course, without a doubt, true. Making sure the local codemonkey is crafty enough is handy too. Websites need more arranging then you’d think.

    doctype is something that should be a case by case basis

    Yeah, but it’s no option to jump back to HTML for the reasons Faruk points out. MIME-types are one thing I want to hear Anne about.

  3. well for me personally I have no intentions of going back to html, unless as I mentioned a situation comes up where I have no choice.....

  4. Personally I am of the thought that XHTML brings good discipline to a project and so what if it is tag soup, not a single ‘major’ browser is effected as far as I can tell. Try serving up Opera with the correct Mime type and a bit of malformed code, it just vanishes.

    As for client updates, I am more and more offering Macromedia Contribute for my clients to update text, if you set it up well and think about how you approache it, it can and does write perfectly good XHTML.

  5. Dave Shea wrote an article last year called Markup: Bulletproof XHTML. Cited in that article was an experiment by Jacques Distler which may help shed light on things here. In short, he recommends modifying Apache to feed the proper doctype to browsers (read: Mozilla, Opera, etc) which are friendly to application/xhtml+xml.

  6. That’s where I fail to support the cause. My code is valid, nothing to say about that. But when served up with the correct MIME-type, it doesn’t work. That’s why I use text/html.

  7. What I have done in the past is create a style guide. The style guide instructs the client on coding style, font usage, color schemes, etc. The contract I have states that they will use the style guide - and they can call me for help - but if they break the rules of the style guide, then I am not obligated to help them.

    Style guides are extremely helpful. :)

  8. Rob,

    First of all, I want to point out that your form fields have no color: specified; I am typing this in light grey on an almost-as-light background, making it real hard to read what I’m writing. You may want to add a color: #000; rule to your input and textarea CSS ;)

    Anyway:

    Writing HTML is bad, writing XHTML without the correct MIME-type is bad too.

    Just because some tech-frenzies are trying to convince you it’s bad to write XHTML with text/html headers, doesn’t automatically mean it’s actually bad.

    Why is it bad? Because “the specifications say so”, is pretty much the whole reason. Now, on top of all the points I’ve made in my Case for XHTML article, I should note that it’s not much use for the tech frenzies to tell people not to use XHTML unless they can do it with the right mimetype.

    Let’s prioritize here, people! We still have 99.99% of the Internet to convert to an at least SOMEWHAT Standards-oriented level. Let’s not scare off the few people that are actually willing to do so, by telling them “not to do so”!

    XHTML is the future of Web Standards, and it doesn’t matter Squat if you send it as text/html. “But it’s bad!” - no, it isn’t. It doesn’t harm anyone, anywhere, except maybe the pride of the five tech frenzies that exist. Sending XHTML as text/html to browsers causes no conflicts or strange renderings, but it does a lot of good things for the fight for Standards, so we should endorse anyone and everyone to use XHTML, regardless of whether they can do it completely right in one go or not.

    After all, even the tech frenzies started out using XHTML and sending it as text/html for the longest time themselves. You think they would’ve liked it if someone kept telling them they were doing it wrong and should go back to HTML? No way! So let people learn things in their own pace, eventually they’ll become able enough to make their pages work in application/xhtml+xml as well, while also managing to ensure the XHTML-validatity of their pages.

    I’ve tried to serve this blog up as application/xhtml+xml, but it didn’t work, which was quite ashaming. Now, what should I do? Switch back to HTML 4.01, XHTML 1.0 Strict, or toss in another MIME-type and risking faulty pages? I know my XHTML knowledge fails on a certain level, so help me

    Without going through lengths to see what it does myself, could you perhaps tell me what problems you were encountering? XML errors? strange CSS rendering? What?

    If it’s CSS, keep in mind that CSS under application/xhtml+xml works slightly differently.

  9. Textarea fixed now.

    I know it isn’t bad, but I’m trying to emphasize here the big problem with web standards - you can hardly do any good. I recall a certain X-Philes...

    And the MIME-play, I’ll check it again. It was really, really bad. Had to do with my damn clean markup :l

  10. Ahh, much better, thanks :) (color:#000)

    Yes, in the case of XHTML you’ll have people say it’s virtually impossible to truly do it right, but that’s not something we should worry about. The X-Philes only showed the perspective of an x-phile (think audiophile but then for the XHTML-standard), and while it’s important to listen to them, they aren’t the final word on the situation. Companies are, as they’re the ones that pay us to make their sites. And companies really don’t lose sleep if you send their XHTML site with a text/html header, because it doesn’t harm anyone. Using HTML does: it hurts the fight for Web Standards, and thus that hurts all of us.

  11. The only kind of errors you get if you use the correct mime type with xhtml is xml parsing errors which basically mean some tag is either left unclosed or not properly nested or something like that.
    I know it took me a while to get used to it and it was kind of a bitch, but thanks to my obssesive compulsive behaviour on the subject of standards and validation and all I was able to succeed.
    My advice, give it another try, its not easy but its not impossible either.

  12. Oh, you won’t believe it, but check your response headers :P

  13. [...] n.

    Semantic code = coding usability

    Everybody is talking about why you �should� serve your XTML pages as �application/xm [...]

Participate, yes!

(Rock out with Textile; it's what the cool people use!)