Previous Page
Next Page

Validating Pages

When creating your pages, it's a great idea to make sure that you're making pages that adhere to Web standards; such pages load quicker in modern browsers and are easier to maintain. The easiest way to check a page that you're working on for valid code is by running it against the page validator maintained by the World Wide Web Consortium (W3C), at This bookmarklet, Script 17.13, checks the page currently shown in your browser for validity. It does this by taking the URL of the current page, passing it to the validator, and then opening a new window with the validator's results, as shown in Figure 17.24.

Script 17.13. Use this script to make sure your pages contain Web-standard, valid markup.


Figure 17.24. Running your page against the W3C validator returns this happy result, if you've coded your page correctly.

To validate your pages:

  • javascript:void(' '+widdow.location.href,''
    ,'width= 800,height=900,status=yes, resizable=yes,scrollbars=yes, location=yes'));

    This one, useful as it is, isn't exactly rocket science. First, we open a window and pass that window the URL to the validator. You'll note the validator has a parameter, uri, which accepts the URL of the current page, which we pass as window.location.href. The plus sign between the two concatenates the location object to the validator's URL. The rest of the line is just parameters for the window's size and other attributes.

Previous Page
Next Page