Encoding of ampersands in GET requests

Well I’ve just learn’t something new!

Basically, the following HTML is incorrect:

<a href="http://www.example.com/index.cgi?foo=bar&moo=poo">Click me</a>

and the following is correct:

<a href="http://www.example.com/index.cgi?foo=bar&amp;moo=poo">Click me</a>

According to this article you should encode ampersands in querystrings (when in an HTML document) as entitiy references (&amp;). I can now go to bed a happy man ;-)

Sociable:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Furl
  • NewsVine
  • Reddit
  • YahooMyWeb

3 Responses to “Encoding of ampersands in GET requests

Leave a Reply