So there I was, one more time validating our main page at work, expecting it to pass W3C HTML validation. I ran Validate HTML under Tools in Chris Pederick’s Web Developer’s Toolbar and the page failed. We run validation frequently on that page, and it was passing almost all the time. So what was up?
All I did was add a link.
The link I added was the problem. But it was just a link, what could possibly be wrong? Well, unescaped characters were the problem. Say what? The link ended like this: ?langId=-1&storeId=10057&catalogId=10001. In HTML the ampersands (&), which represent spaces, have to be replaced with & or they won’t validate. Trouble is, when I wrote the ampersands as escaped characters the link wouldn’t work. NOW what!
This is where TinyURL comes in handy. You can find TinyURL at a tiny URL: http://tinyurl.com/. Simply paste the URL you want to make tiny into the “Enter a long URL to make tiny:” data entry field. Hit enter and a tiny URL is created. Simply copy the tiny URL and paste it into your HTML. With no unescaped characters the page passes W3C validation. Thanks TinyURL!