HOWTO: Painless markup validation with Opera and Ubuntu
Opera has a rather neat feature for validating markup. By pressing Ctrl-Alt-V or if you right click on a page and select “Validate”, you send off the data to the W3C validator.
However, if you ever work offline, or you, like me, work with markup that shouldn’t be transmitted to external sources, or if you want a validator that responds immediatly, there is a better solution: Installing the validator locally. Here’s how to install the validator locally in Ubuntu, and then configuring Opera to use the locally installed validator instead of the external one.
Installing Apache and the validator
The first thing you’ll have to do, is to install Apache and the w3c markup validator on your local system. Type the following in a terminal:
sudo apt-get install apache2 w3c-markup-validator
apt should take care of all needed dependencies for you. When installation is finished, continue to the next step:
Configuring Apache
(Updated: The previous version edited /etc/apache2/apache2.conf directly, which is a bit more messy if you feel like disabling the service later)
Next, you will have to add the validator to your Apache configuration by adding the validator configuration as a virutal site:
sudo gedit /etc/apache2/sites-enabled/validator.conf
When you have the file open in gedit, insert the following into the file:
ScriptAlias /w3c-markup-validator/check /usr/lib/cgi-bin/check
ScriptAlias /w3c-markup-validator/checklink /usr/lib/cgi-bin/checklink
Alias /w3c-markup-validator /usr/share/w3c-markup-validator/html
<Location /w3c-markup-validator>
Options +Includes +MultiViews
AddHandler server-parsed .html
</Location>
Save and close the file. To start the validator, you now have to restart apache. Again, by going to the terminal:
sudo apache2ctl restart
Verify that you have the web server and the validator running by visiting http://127.0.0.1/w3c-markup-validator/
Configuring Opera
The final step is configuring Opera. Go to the Opera configuration editor: opera:config#UserPrefs|ValidationURL (clicking this link should be just fine). Replace the contents of the input field Validation URL, that has the following default content …
http://validator.w3.org/check
… with
http://127.0.0.1/w3c-markup-validator/check
Now, click “Save” in the configuration editor, and close the configuration page. When you now press Ctrl-Alt-V when visiting a page, Opera will now open the validator on your local system, hopefully saving you some time in the process.
Comments
Comment from Stahn on 2006-10-03 20:44
Sorry for being a little offtopic, but do you have a tutorial/manual/whatever for doing this with Windows XP?
Comment from Grah on 2006-10-03 23:04
@Stahn: I guess this would involve installing Ubuntu first ;)
Jokes aside, from what I know, one can setup Apache on XP with XAMPP. Once installed, the steps should be the same (but it is quite likely that I’m wrong).
Comment from Jad on 2006-10-03 23:12
Cool!
Also user could add the validation URL into firefox Web developer extension.
Comment from Alexey Feldgendler on 2006-10-04 05:16
It’s a pity that their CSS validator isn’t available as a standalone application as well.
Comment from Arve on 2006-10-04 13:13
Stahn: I don’t use Windows, so, no. But W3C has a guide for installing the validator on Windows
Comment from Tijn Schuurmans on 2006-10-04 16:05
@Alexey:
The css validator seems to be avaiable via CVS at
http://jigsaw.w3.org/css-validator/DOWNLOAD.html
Comment from Stahn on 2006-10-05 08:19
Hmm, uses Perl… tricky =P I have to install it anyways, so I’ll give it a try later.
Thank you everyone =)
Comment from Asbjørn Ulsberg on 2006-10-09 13:50
I’ve been trying to get the W3C Validator to work on Apache 2.2 under Windows for 2 hours now, but it’s frikkin’ impossible. Apache 2.2 and ActiveState Perl was easy enough to get up and running, but installing and configuring the Validator is the biggest pile of stinking, non-working and half-assed operations I’ve ever seen.
I know the best answer is to switch to Linux, but that’s just not even close to being an option in my current job. Well, not if I want to checkk e-mail, log on to the network, have access to the source control server, the development environment, etc, etc. And I kinda need all of that to do my job.
So if anyone knows of a more pre-configured distribution of the W3C Validator for Windows, please leave a comment here, because the default distribution the W3C developers have cooked up really only works on Linux. I’m sure it’s possible to get up and running on Windows, but not within an acceptable time frame.
Comment from Arve on 2006-10-09 14:02
Asbjørn: VMWare player and a preconfigured Ubuntu image, perhaps?
Comment from Asbjørn Ulsberg on 2006-10-09 14:05
Yes, that’s a possibility. To have to run a whole operating system inside Windows to get the W3C Validator to run seems a bit over the top to me, though. It’s just silly that it doesn’t work out of the box on Windows, imo.
Comment from Mike on 2006-10-10 07:48
Yeah, I also need something for my Windows. But then, anyway, thanks for the link, man.
This discussion has been closed. No further comments may be added.