Jump to content

Changes for XHTML 1.1


Glom

Recommended Posts

I noticed there is a XHTML 1.1 and I tried to get one of the pages of my site validated under it. This page had been validated with XHTML 1.0. There was only one complaint.It didn't like the use of the lang attribute in my first html tag.

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

How important is lang? Is there something new to replace it for XHTML 1.1?

Link to comment
Share on other sites

don't forget to use

<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8"/>

, which will probably break in IE! otherwise, with

content="text/html;

web browsers treat you page as html, not xhtml. And not only dose it treat it as html but as tag soup (html 3.2 or random html junk) because you have an invalid html doc type. This can have unpredictable results in how the page is displayed.
Link to comment
Share on other sites

Changing the <meta> is not what will break IE, nor is what will change the MIME type. Try it if you don't believe me. What will break IE and what is the correct way of serving XHTML is to set the server to serve files with that MIME type. In Apache's configuration file, this might look like:

AddType application/xhtml+xml .html

In order to enable this MIME type for every user agent that supports it and use text/html only for IE and other user agents that don't support this MIME type, you need server side scripting.In this topic GT500 shows a simple PHP script to switch between the two and even the DTD if needed. I do reccomend not changing the DTD though. Trying to handle a single piece of code across two MIME types and IE on top is enough trouble as it is.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...