Add “Validate Entire Site” to Web Developer Extension

It’s pretty easy to add a tool to Chris Pederick’s Web Developer extension that will spider an entire site and validate it for you. The WDG validator (which the Web Developer extension doesn’t use by default) will do this for you if you add the right options in.

To add “Validate Entire Site” as a custom tool

It’s quite straightforward really. You just need to create a new tool in the Tools options (version 0.9 and up, I think) and make sure &spider=yes is in the URL for the WDG validator. Just follow these steps:

  1. Select “Options…” from under the “Options” menu in the toolbar.
  2. Find the “Tools” options.
  3. Add a new tool by using the “Add…” button.
  4. Enter the tool description (I use “Validate Entire Site”).
  5. In the URL field copy and paste this: http://www.htmlhelp.com/cgi-bin/validate.cgi?warnings=yes&spider=yes&url= The URL of the current page in the browser window will be appended to what you enter here, so the &url= must be at the end of this line.
  6. Optionally, you can also add a keyboard shortcut for this tool, so that you can validate an entire site with Control+Shift+[key].
  7. Hit the OK button to save your new tool.

Important! Please note the updates below. There are a few limitations with using the WDG validator for this tool.

To validate a page or an entire site with a custom XML DTD

By default, the Validator assumes that a custom DTD is HTML or SGML. If your custom DTD is XHTML or XML, then you need to include the Validator’s hidden “xml” option. When validating a URL, you can specify this option by appending “&xml=yes” to the URL of the validation results. WDG HTML Validator Tips

So, this would mean that you need to add &xml=yes into the URL for your tool.

For validating a single page with a custom XML DTD:
http://www.htmlhelp.com/cgi-bin/validate.cgi?warnings=yes&xml=yes&url=

For validating an entire site with a custom XML DTD:
http://www.htmlhelp.com/cgi-bin/validate.cgi?warnings=yes&xml=yes&spider=yes&url=

Updates

15 February 2006

This article is proving fairly popular, so I thought I’d add a couple of useful links to this tip.

30 March 2006

It’s also worth noting that the WDG validator limits its spider to checking the first 100 pages it finds.

09 July 2006

You may find that the WDG validator only validates one page if you use this tool on a page within the site you wish to validate. Use the tool on the main domain (e.g. http://dotjay.co.uk/ rather than http://dotjay.co.uk/index/) to get the validator to spider the whole site.

24 August 2006

Someone asked about validating password-protected sites. The WDG validator does allow you to validate pages behind HTTP authentication, but you must provide the username and password in the URL. The validator cannot spider a site you are already authenticated on – you must provide access details in the URL.

The Web Developer toolbar gets around this for individual pages by either asking you for access details when trying to validate a password-protected page or allowing you to use “Validate Local HTML, saving a local copy of the page and uploading that for validation.

When adding custom tools to the Web Developer toolbar, you don’t have the means to trigger a request for access details. To validate an entire site which is password-protected, you need to ensure that the username and password is entered as part of the URL.

27 March 2007

I’ve just noticed that you can also add &hidevalid=yes to the URL to get the validator to hide the valid results it finds for your site, making it much easier for you to find problems!