Test your HTML code locally

Although it is easy to find sites that can validate your HTML code, sometimes you might not want to use them. Maybe the page cannot go outside a firewall, or your company doesn’t allow you to submit the code to an external site.

Apple suggests an easy way to validate your HTML, just like you would anywhere else, except that the services will be hosted within your network. Here’s how you can achieve this:

1. Install Xcode Tools 1.5 or higher, if you don’t have it already.
2. Download the following files: http://validator.w3.org/validator.tar.gz, http://validator.w3.org/sgml-lib.tar.gz
3. Decompress the files inside a new folder–> /Library/WebServer/Documents/validator/
4. Edit the validator.conf file: write your e-mail address on line 73, your URL on line 77, /Library/WebServer/Documents/validator on line 24, and change ‘SGML Parser’ from ‘/usr/bin/onsgmls’ to ‘/sw/bin/onsgmls’ on line 37.
5. Copy it to this location:

macosx:~ macosx$ cd /etc

macosx:/etc macosx$ sudo mkdir w3c

macosx:/etc macosx$ cd w3c

macosx:/etc/w3c macosx$ sudo cp /Library/WebServer/Documents/validator/htdocs/config/*.* .

6. Add to the httpd.conf file:

<Directory /Library/WebServer/Documents/validator/htdocs>

Options ExecCGI IncludesNOEXEC Indexes MultiViews

AllowOverride None

AddHandler server-parsed .html

AddCharset utf-8 .html

</Directory>

<Location “/validator/htdocs/check”>

SetHandler cgi-script

</Location>

7. Install Fink and OpenSP.

Done. Your working validator is now at http://localhost/validator/htdocs/

For a more detailed guide, go to: http://developer.apple.com/internet/opensource/validator.html

Technorati Tags: , ,


 
 

Post a comment to "Test your HTML code locally"



Support MacTips

MacTips Newsletter


Random Popular Tips

Recent Comments

Recent Discussions

MacTips Poll

What level of tips would you like to see?

View Results

Loading ... Loading ...

Friends of MacTips

Subscribe to MacTips

Site Links