skip to content
 

Validating your web pages

Why Validate

We are required by law to have our web pages accessible by all. The university has published guidelines about this. A page written in valid HTML is much more likely to be readable by all screen readers.

Successfully running your web pages through a validator is a prerequisite for accessibility.

You can validate web pages via any web browser e.g. internet explorer or firefox.

Validating Errors

When you run your web page through a validator you may receive dozens of errors. Don't worry; like with LaTeX often fixing one error fixes many errors.

If you have problems correcting any DAMTP, DPMMS, Statslab, Maths or CMS web page errors reported by the validator, please email help@maths who will assist you in finding the error. Obviously you'll need to include the address of the web page or the location of the html file in your email.

Validating web pages via your web-browser

The easiest way to validate a web page is to go to the address http://validator.w3.org/ and type in the page's web address in the form provided. Or upload the file or copy and paste the code in via the optional tabs on the above page.

If you will be validating many pages, you may wish to create a bookmark or favourite which takes the page you have open in your web browser and runs it through the validator. To do this add a bookmark or favourite pointing at (one long line)

javascript:void((function () { var script=document.createElement('script'); script.src='http://www.damtp.cam.ac.uk/validator/upload.js'; document.body.appendChild(script) })())
Creating bookmarks using Firefox
To create a bookmark in Firefox go to Bookmarks -> Show All Bookmarks. Highlight the location where you want to save the bookmark e.g. Bookmarks Menu. Select Organise then New Bookmark. In the Location section paste the validator code given above.
Creating bookmarks using Internet Explorer
Unlike with Firefox I cannot find a direct way to do this. Add any random page to your favourites, then change the name to something like "Webpage Validator" and the URL to the code given above. To edit the link go to Favourites -> Organise Favourites -> a window will appear containing your favourite pages. Right click on the newly created favourite and select Properties. Select the tab called Web Document and insert the validator code in the field called URL: via paste. Select OK.

Using the linux command line validate tools

     # show errors in index file
     tidy -e ~/public_html/index.html

     # make 'tidied' version for testing
     tidy ~/public_html/index.html > ~/public_html/indexnew.html