Solving script and other problems for serving true xhtml 1.1

C

cwdjrxyz

I am now writing many new pages in xhtml 1.1. They are served as true
xhtml by setting the mime type of the server to application/xhtml+xml
for the .xhtml extension. Since IE6 and some earlier browsers can not
handle this mime type, a simple php include is at the very top of such
pages. If the mentioned mime type support for the viewing browser is
detected, everything above the head tag of the page is written in xhtml
1.1 code. If the browser can only support text/html, then everything
above the head tag is written in html 4.01 strict. Also a regular
expressions converts self-closed tags such as <br /> to <br> as
required for html 4.01 strict. Several methods of using such a php
script have been reported. I selected methods that work best for my
purposes.

Code for media is very difficult to get to work on a variety of
browsers and also validate. See
http://www.cwdjr.info/media/playersRoot.php . This page has many links
that will explain how one writes the code. The WMP(Script) link will be
of most interest to this group. In an older html version of this page,
many document.writes were used in for loops to write a very large
number of divisions. This will not work when written in xhtml 1.1 and
served as mime type application/xhtml+xml. When you serve true xhtml
1.1, browsers that can handle it become very strict and parse the page
in xml. Even the smallest error, such as one unclosed tag, gives a xml
error message rather than a view of the page. However this problem is
easily solved by writing a server side php script to replace the client
side javascript that included the forbidden document.write for loops.
The browser now gets all of the divisions that are written by the
server so that the xml parser can check all of them for closed tags,
etc. Tags that are not closed are one of the major no-nos of xml. If
you use a document.write there is no telling what code it might
generate, including unclosed tags an symbols forbidden by xml. Of
course in simple cases you sometimes can use DOM methods to get around
a document.write, but in this case with so many complicated expressions
using document.write, it is much easier to use php on the server. Or
you can use Perl or other languages that you might like better.

Next view the page at http://www.cwdjr.net/geometric/tilelayerRoot.php
.. You may view the text of the php page at:
http://www.cwdjr.net/geometric/tilelayerRoot.txt . This page in the
original html version generated about 2500 divisions using a nest of 3
for loops with a document.write at the bottom of the nest. Of course
this will not work in true xhtml served as such. In this case nearly
all of the code is written in php at the server and downloaded when the
page is called. This is a very extreme example. However, if you have
both a Mozilla family(Mozilla, Firefox, or Netscape) and Opera browsers
in recent versions, view the page on both. You will notice that the
Mozilla family browsers show you nothing until the page is completely
downloaded. However the Opera browser shows each cell as it is
completed. Thus Opera seems to handle a long page much better than the
Mozilla family, since it allows you to see something as the code is
processed. The Mozilla family browsers also have a css bug when the
page is partly filled. The background-color used in the css style sheet
extends only to the bottom of the content of a short page, leaving the
bottom of the page white. If you use only absolute positioning, the
background-color is not displayed at all! This is easily corrected by
enclosing the whole page in a division with a background-color set in
the style for the division. This is shown in the code of some of the
pages I quoted. Opera does not have this background-color bug. From
what I have seen, Opera handles true xhtml 1.1 better than the Mozilla
family browsers. However, if I had used other pages, it is quite
possible I could have found some Opera bugs that do not apply to the
Mozilla family.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top