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.
h3. 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:
h3. 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:
bc.. 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
Options +Includes +MultiViews
AddHandler server-parsed .html
p. 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/
h3. 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 …
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.