Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to open in Firefox, but it fails with a XML parsing error. Chromium has a similar issue with it, but it shows at least the document until the error.

Both results are unwanted, I just want to get the page parsed as HTML. What options do I have other than using a different browser?

share|improve this question
save link as... then change extention to html (or investigate why it is faulty and report to webmaster) (IE7 forces download so I tihnk it's the content-type that's not getting set) – ratchet freak Sep 25 '12 at 9:02
up vote 4 down vote accepted

For static documents, the following bookmarklet will work as intended: The XHTML document will be displayed as (not-so-strict) HTML.

 var x = new XMLHttpRequest();'GET', location.href);
 x.onload = function() {
   var d = document.implementation.createHTMLDocument('');
   d.documentElement.innerHTML = x.responseText.replace(/^[\S\s]*?<html\b/i, '<html');
   document.replaceChild(d.documentElement, document.documentElement);

I'm stripping the first characters up to the <html> tag. Otherwise, everything ends up in the <body> tag. Consequently, styles (and scripts) would not be applied quite well.

share|improve this answer
Neat, I tried something similiar using document.write (ugly) or innerHTML/replaceChild or DOMParser, but none of them worked. This works great, thanks! – Lekensteyn Sep 25 '12 at 9:10

If it's only once in a while, you can devote a bit of manual effort. When you see the XML parsing error, you can go back, right-click on the link, and choose "Save link as". Then edit your copy of the HTML to correct the error. Open your corrected copy in your browser.

By deleting the "</table>" tag that was noted in the parsing error, I was able to view the page that you indicated.

share|improve this answer
This will break hyperlinks and is also inconvenient given that there are multiple pages on that site that are broken. Isn't there a special URL of setting to get XHTML parsed as HTML? Also, I am not actually interested in fixing the markup and want to have the flexibility of browsers being able to parse malformed HTML without complaint. Having some display errors is fine, as long as I can read the page. – Lekensteyn Sep 25 '12 at 9:05
OK, thanks for your clarification. – minopret Sep 25 '12 at 9:10
+1 because it is a usable solution. – Lekensteyn Sep 25 '12 at 9:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .