Re: [VE][82] Error Message Feedback

Marco Nef wrote:
> Checking one of my pages (e.g.
> there is always an error message that is about one of the JavaScript
> scripts. Obviously there's an error in your application. Maybe you should
> just ignore any scripts.

No, there is no error with the validator in this case.  It is your 
document that is invalid, you simply do not understand the reasons.

The most common script error occurs with document.write() statements, 
and is explained by the WDG.

However, those particular errors apply only to HTML 4.01, not XHTML 
documents.  Although, there are many other things you need to be aware 
of if you are going to use XHTML, but I strongly recommend you switch 
back to HTML 4.01, at least until you have a better understanding of 
what you are getting yourself into.

Firstly, document.write() does not work for XHTML documents.

The only reason it may appear to work for you in existing browsers is 
because you are using the incorrect MIME type (text/html).

If you serve your document correctly as application/xhtml+xml, you will 
find that the supporting browsers will choke on your validation errors 
and simply not display the page.

To demonstrate: You will need a browser that supports XHTML, such as 
Firefox, Mozilla or Opera.  (IE *does not* support XHTML, so don't waste 
your time with it)

1. Copy the markup that the browser recieves (Use view source in your
    browser, don't use the PHP code which is executed by the server.)

2. Paste this markup into a new text document and save the file with a
    .xhtml extension.

3. Open the file in your browser from your local file system
    (ie. you don't upload to a server) and see the result.

If you are unhappy with the results, you will understand why using XHTML 
is not as simple as you thought.  Even if you fix the validation errors 
so that browsers don't choke, your document.write() scripts will not 
work.  This should explain why you should switch back to HTML 4.01, at 
least until you have a better understanding of the issues.

The documents I have referenced plus the the descriptions provided by 
the validator should help you understand how to fix the errors.

Lachlan Hunt     Rediscover the Web Reclaim your Inbox

Received on Saturday, 9 April 2005 15:30:53 UTC