Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 137615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:08:03+00:00 2026-05-11T07:08:03+00:00

When I have a markup error in my XHTML page, Mozilla Firefox displays the

  • 0

When I have a markup error in my XHTML page, Mozilla Firefox displays the ‘Yellow Screen of Death’, showing only a large red error message on a yellow background.

While these errors are rare, they are extremely user-unfriendly.

Is there a way I can detect these using Javascript, and thereby send a message back to the server?

What I’ve discovered so far: – Scripts placed before the parsing error still run. (Of course.) – Timeouts and intervals that were set in these scripts will still execute after the parsing error. – In Firefox, the DOM is a <parsererror> with a <sourcetext> inside it. I can detect this if I query document.firstChild.tagName.

Remaining questions: – What events are available that I could listen for to detect this happening? (Polling sucks.) – How can I detect this in other browsers?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T07:08:03+00:00Added an answer on May 11, 2026 at 7:08 am

    Catching parse errors on the client might be possible, but it’s really solving the wrong problem.

    I know this isn’t what you asked for, but unless you’re doing something truly XHTML-specific like embedding some other markup language, you should serve your page as text/html instead of application/xhtml+xml. Even if it’s XHTML. By serving it as text/html you’ll avoid the problem you’re running into and allow your page to work in IE as well. Note that it’s the MIME type and not the doctype declaration that determines which parser is used — using a transitional doctype won’t do it.

    That said, if you’re really sure you want your page parsed as XHTML, it’s better to handle this kind of error on the server. Generate your page by building up a DOM and then send the result of serializing it. If that’s not an option, then start by generating the page as you do now but don’t transmit it to the client yet. Take the XHTML that you’ve generated and parse it server-side with a validating XHTML parser (or at the very least, a generic XML parser). If you get errors, display whatever error page you want. Otherwise, serialize the parsed DOM and send that to the client.

    In summary, the basic rules for using application/xhtml+xml are:

    1. Don’t.
    2. (For advanced users) Don’t, unless you’ve proven that you’re doing something that won’t work if the page is served as text/html. This applies to a tiny, tiny fraction of a percent of XHTMl documents.
    3. If you must serve your page as application/xhtml+xml, generate it with some method that guarantees validity.
    4. Unless you really know what you’re doing, never use application/xhtml+xml for a page that includes user input.

    Remember that XHTML is just a reformulation of HTML 4 plus the ability to embed other languages. If you don’t use the embedding, what you have is HTML 4 with a different but almost completely compatible syntax. The overwhelming majority of XHTML documents out there are served as text/html and thus treated like HTML 4 by browsers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 140k
  • Answers 140k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There is no Button.PreviewClick event. You might try using Button.PreviewMouseDown… May 12, 2026 at 7:54 am
  • Editorial Team
    Editorial Team added an answer Assuming you're talking about WinForms, you can set the FlatStyle… May 12, 2026 at 7:54 am
  • Editorial Team
    Editorial Team added an answer For example try following code (add it to your view):… May 12, 2026 at 7:54 am

Related Questions

I have a few labels on my page with a class of 'error', the
I have a datagrid that's bound to an observablecollection object. The collection may be
(Was: ASP.Net codebehind not finding controls on the web page) I'm using VS 2008.
Tonight I copied an ASP 2.0 web site onto a client's machine, and lo!

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.