Is there any way to inform a Web browser that a document is coded in XHTML5, i.e. XML serialisation of HTML5? This question is not as obvious as the first impression may suggest — a conforming XHTML5 header is identical to this used for XHTML 1.0 so my browser (Mozilla Firefox 18) treats XHTML5 as XHTML 1.0, thus complaining on everything which hadn’t been available before XHTML5 arised.
According to W3C HTML5 Candidate Recomendation, the DOCTYPE header is optional (and even wrong for a valid XML), the html namespace is exactly the same as for XHTML 1.0. So how do we know how to classify the code below? And how does the browser distinguish the two standards?
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB">
<head>
<title>A questioning document</title>
</head>
<body>
XHTML5 or XHTML 1.0 — that is the question...
</body>
</html>
<iframe>in XHTML5 (i.e. XML mode) works fine in Firefox. But you need to identify the iframe with theidattribute, not thenameattribute.On the other hand, for IE9, you need to use the
nameattribute and not theidattribute.Best then, is to use both, set to the same value.
See http://www.alohci.net/application/xhtml+xml/iframe-in-xml.htm.ashx for an example.