Validating your webpages
Why Validate
We are required by law to have our webpages accessible by all. The university has published guidelines about this . An accessible page will be readable by all screenreaders. A person needing to use a screenreader will not have a choice to switch to a standard webbrowser when they come across a page their reader cannot use.
Sucessfully running your webpages through a validator is a pre-requestite for accessiblity. After all it is not possible for you to check all the screen-readers.
You can validate webpages either via your web-browser eg internet explorer or firefox or via the linux command line.
Validating Errors
When you run your webpage 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, Maths or CMS webpage errors reported by the validator tool please email webmaster@damtp who will assist you in finding the error. Obviously you'll need to include the address of the webpage, or the location of the html file in your email.
Validating webpages via your web-browser
The easiest way to validate a webpage 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 -> Manage (or Organise) Bookmarks -> Select New Bookmark -> In the Location section paste the validator code given above. If you want the bookmark to appear in your Bookmark (or Personal Toolbar Folder) toolbar (that is the panel typically below the location field in firefox), then drag the newly created bookmark to the Personal Toolbar via the bookmarks manager window. - Creating bookmarks using Internet Explorer
Unlike with Firefox I cannot find a direct way to do this. Indirectly add any random page to your favourites and call the link webpage-valiator. Put the validator code above into your copy buffer and then edit the link you just created. 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
# use validate to show errors and warnings on html file
validate -w ./public_html/index.html
# same for http document generated by tidy (above)
validate -w http://www.damtp.cam.ac.uk/user/AB123/index.html
Further information