HTML Validator extension for Safari

A couple of days ago, Apple announced support for developing extensions, so I felt obliged to implement my HTML Validator extension for Safari too. :-)

The HTML validator extension for Safari

A picture of the HTML Validator in Safari
A picture of errors in the HTML Validator in Safari

The extension basically offers three options:

Validate URL
Takes the URL of the current tab and opens a new tab with the W3C validator and its validation results for it.
Validate local
Takes the generated HTML of the current web page (especially good for local content) and posts it to the W3C validator. Note: Currently opens the W3C validator in the same tab, since the extension model doesn’t support posting forms/content to new tabs.
Autorun
If you enable Autorun (on by default) it automatically validates the URL of the current page and displays number of validation errors in the HTML Validator bar.

You can enable extensions and adjust their settings in the extensions view:

A picture of the extensions view in Safari with options

Download

Bear in mind that this is a first version and can be a little rough around the edges. However, if you want to try it out, download HTML Validator for Safari from GitHub. Note: it only works in Safari 5.

The Safari extension model

So, it’s interesting to see Safari bet on extensions as well, to be able to compete with other web browser. I’m glad they did, but being Apple, of course they have to do it their way.

Pros

The upside of the extension system is that it’s based on HTML, CSS and JavaScript. That’s it. There’s some pretty good descriptive documentation on how to develop extensions and the Safari Extensions Reference is a good overview for properties and methods.

You build/create extensions with the Extension Builder, which I hated at first (since I want a master file I can edit, not a form to fill out), but over time, it is actually quite easy to use instead of over-typing in a pkist file.

Cons

Another web browser, another extension model. It is quite similar to the one find in Chrome, but still different. If all web browsers are to start supporting extensions, as developers we must get the same means of developing them. It’s not ok with a different approach for each web browser. And, since Safari are the last ones out (well, ok, not Opera yet), they really should have matched an already existing extension model, for instance, the one found in Google Chrome.

Also, in the Apple spirit, you need to sign up for the Safari Developer program (free) just to be able to develop an extension, and also create certificates with which you sign your extension. Basically, just a lot of hassle. Sure signing is necessary, but there are other ways (see below).

What you can do in the web browser is pretty limited and some obvious features seem to be missing so far (for instance, an event when a tab gains focus).

Also, I can’t believe they start offering extensions without a proper extension web site where people can easily share them. I know such a web site is in the works, and when it’s released it will be much nicer. Also, there you can have automatic extension signing so developers don’t have to care?

And, please, skip the Apple Developer Program bit…

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>