I see a web page containing the following band
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml" >
Does this mean this page use XHTML? Is there any difference between
HTML and XHTML?
Even if the code is completely valid html at the W3C validator, the
page on the web that someone views is not xhtml unless it is served as
application/xhtml+xml or application/xml, or very rarely another xhtml
mime type. On most servers, if you use the extension .html, the page
is served as the usual text/html mime type. If you then use .html for
a page written in xhtml code and use the .html extension, the page is
just served as ordinary html, and the xhtml code serves no useful
purpose over html 4.01 strict. If you want to serve the page as true
xhtml, on the server you must associate some extension other
than .html with a mime type for xhtml, since .html is already reserved
for ordinary html. For example you could associate .xhtml with the
mime type application/xhtml+xml. The W3C validator, in the extended
mode, will tell you if the page is being served as text/xhtml,
application/xhtml+xml, etc. If served properly, browsers that can
handle true xhtml become extremely strict and parse the page as xml. A
little error on a page served as html often does little harm, and the
page often can be viewed with perhaps some distortion. However, on a
page parsed as xml, the least little error often results in an error
message, and the page can not be viewed at all. For example,
absolutely everything must be closed in xhtml, because xml demands it.
On many xml devices, not closing is one of the most serious errors you
can make. Thus if you write <br> instead of <br />, the whole page may
be killed and you get only an xml error message when you try to view
the page. Use of xhtml may give you a nasty surprise if you use
javascript. A document.write will not be accepted. The reason is
document.write could generate some code that contains some xml error,
In this case the solution is often to use server side script such as
php to generate the code that a document.write would do. Then the
generated code is downloaded to the browser so it can be properly
parsed as xml and checked for xml errors. I would guess that over 90%
of pages written in xhtml code are mis-served as text/html. If you
serve as true xhtml, no IE browser, including IE7, can handle it. Thus
you must provide an html path for IE, using one of several tricks, or
complete separate html pages for IE.