revjim.net Rotating Header Image

URLs can't have ampersands in them

Although I've been in the business of creating web sites and web applications for almost 7 years now, today I learned something new. Alex pointed out that my Index page wasn't validating, so I started to research it to find out why.

It makes perfect sense that they should be, it just never crossed my mind before now. When you include an ampersand (&) in HTML it is proper to encode it as an entity: &. This is common knowledge. However, when you include them in the href attribute of an a tag (or in any attribute or any tag, for that matter), they should also be HTML entity encoded. For some reason, my mind has overlooked this for the past 7 years. So, just in case you're overlooking it too, now you know.

Share and Enjoy:
  • Facebook
  • StumbleUpon
  • Digg
  • del.icio.us
  • Google
  • Reddit
  • Technorati
  • Furl
  • Spurl
  • Live
  • Pownce
  • TwitThis