Checking to make sure a website or page is W3C valid and compliant hasn’t always been high on my list of tasks when building a new page or site in the past, until recently.
The company I work for now is very proud of the fact that most, if not all, of the pages on all of their sites are W3C valid to the Scrict standard. Its a good move I think – it makes the developers code better in the long run, so long as we’re always checking for valid code.
So, to check for valid code on a site, I’ve found a neat addon for Firefox called HTML Validator (original, eh?)
However, I have found it to be a little touch-and-go. Sometimes it just doesn’t seem to comply with W3C standards. So I decided to make a small Bookmarklet / Del.icio.us-style browser brookmark link for the current site you’re viewing. Simply make a new bookmark on your browser, and enter the following code as the bookmark URL:
javascript:(function(){f='http://validator.w3.org/check?uri='+encodeURIComponent(window.location.href)+'';a=function(){if(!window.open(f+'','deliciousuiv5','location=yes,links=no,scrollbars=yes,toolbar=no,width=700,height=550'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()
Clicking your new bookmark will bring up a new popup window with the URL of the current page you’re viewing, to validate against the W3C site. Neat!
Dude! That’s superb!
However, can I offer a small suggestion? Give a link containing the text that people can just drag to the toolbar. It took me a hell of an effort to create the toolbar link in FF.
Just run it against my blog and the only validation erros it came up with was the standard code issued by YouTube to embed videos.
Happy days!
Ah yeh, fair play. I’ll make another blog post tomorrow with a draggable link jobbie. Nice.
My sites got like 71 errors, or more! Terrible…
Keep an eye out for a new design soon. Its coming
[...] A few days ago (Ok, a week or so) Daze posted a piece of Javascript he wrote which will pop up a new window and load the W3C’s website validation service. You can read Daze’s post (and get the JS code here. [...]