在加载时自动验证页面(使用W3C验证器)

I am developing a web site whose HTML can vary quite a lot depending on user inputs (user input on page 1 decides which sections of page 2 are shown, etc).

Naturally, I would like to ensure that the HTML is valid, but there are a lot of permutations.

I was wondering if anyone has a code snippet which I could include (in debug mode) in my standard page footer template which would validate the page. That ought to help me catch a lot during development and unit testing.

The catch is that I am developing using NetBeans and Xampp, so my URL is on http://localhost which is not something I can feed to "validate by URL" ...


The following will not work on http://localhost

  • W3C "validate by URL"
  • Web Developer for FireFox
  • Total Validator for FireFox

Looks like it can't be done, then

If your using Firefox, then try the Web Developer Toolbar. It has validation tools.

https://addons.mozilla.org/en-US/firefox/addon/60/