Zappatic
About Safari Validator

Safari Validator is a Safari extension which allows you to validate your website for (x)html compliance. The actual validation is done by Tidy, the W3C validator and the http://validator.nu HTML5 validator. This plugin was initially modeled after a similar plugin for Firefox, which can be found here.

How it works

The extension bar will show the amount of warnings and errors the current page has, along with a small icon. Both Tidy and W3C results will be shown, as they may differ sometimes in the amount of errors and warnings. The HTML5 results are shown only when the loaded page is HTML5. Tidy and W3C are then omitted as they are not relevant for HTML5 pages.

W3C and Tidy validation results
W3C and Tidy validation results

Clicking on the Tidy results will show the source of the current page. The lines containing errors are highlighted so they can be located easily. Doubleclicking on a warning or error in the list will position the cursor at the correct location in the html source text.

Tidy results
Tidy results

Clicking on the W3C results will open a new browser window, containing the report generated by the W3C validator.

W3C results
W3C results
Download Subscribe to the SafariTidy releases feed
Warning

Unlike the W3C validator, the HTML5 validator is not included locally in the extension! This means that to validate HTML5 pages, they are sent over the internet (unencrypted) to http://html5.validator.nu There are two issues with that :

  • Sensitive information may be transferred unencrypted to a third party when you're browsing
  • Keeping the HTML5 validation on all the time generates too much traffic for the validator, and they understandably don't like that.

Only enable the HTML5 validation when you're developing an HTML5 website, otherwise disable it in the Safari preferences!

To avoid these two issues you may also install the validator.nu HTML5 validator locally on your machine. For instructions on how to do so, please refer to he validator.nu website. After installation, you can point the Safari Validator extension in the right direction, by adjusting the preferences to the new (local) validator service.

Installation
  • Unzip the file you downloaded by doubleclicking on it
  • Copy Safari Validator.webplugin to ~/Library/Internet Plug-Ins (create the folder if it doesn't exist)
  • Double-click Safari Validator.safariextz
  • ALWAYS make sure to install both files. Don't mix extensions or plugins from previous versions!
  • Restart Safari
Deinstallation
  • Deinstall the Safari extension from the preferences in Safari
  • Remove Safari Validator.webplugin from ~/Library/Internet Plug-Ins
  • Restart Safari
Disclaimer

The software is provided as-is, and I take no responsibility for any unwanted side effects or problems by using it.

If you like the plugin, please consider a small donation.

Known issues
  • The validation will not occur if you load a local (e.g. on your hard drive) HTML document. This is due to the security measures Safari puts in place, and I cannot / will not circumvent those.
Changelog
  • 03 april 2011 — version 0.3.1
    • Implemented HTML5 validation (by using external service html5.validator.nu)
    • Fix W3C report showing blank screen (was a Safari security measure)
    • Added a toolbar button (with ugly logo) to quickly toggle validator bar
    • Remove border at bottom of websites caused by the validator embed (thanks Veerle!)
    • No embed-injection in iframes anymore (for rich text CMS editors)
  • 10 june 2010 — version 0.3.0
    • Rewritten to use the new Safari 5 extension mechanism
  • For older versions, see the Safari Tidy plugin.
Frequently Asked Questions
Why doesn't the validator show any results when I load an HTML page from my hard drive?
Since Safari 5.0.3 a security measure was implemented revoking access to local HTML pages to Safari Extensions. This means the Safari Validator isn't loaded for local HTML pages. There is nothing that can be done to avoid this issue, other than 'hosting' the files somewhere. Did you know you have an Apache web server installed on your computer? That's ideal to host your local pages!
Why do my pages load really slowly after installing the plugin?
The Tidy validation is pretty quick, but the W3C validation is not. Simply disable the W3C validation in the preferences when you're not developing your website.
Are you using private API's or sneaky tricks to validate the pages?
No! The combination of the new extension mechanism, along with a webplugin allows for a solution without resorting to private API's. There are still limitations on the extension mechanism (it's just HTML/CSS/Javascript) so a special plugin was made to handle the actual validation.
What's this <embed> tag doing at the bottom of my documents?
Don't worry, the embed is just inserted to talk to the plugin. It should not interfere with the rest of the document. If it does, do let me know!