Forum Moderators: open

Message Too Old, No Replies

Ampersand in querystring. Should it validate?

Just wondering

         

dataguy

2:57 am on Aug 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've been using the HTML validation tool on Firefox for a few days. I've been building web sites for nearly 10 years, but I've never tried to validate any of my code before. It's actually kind of fun fixing my code to make sure it's 100% correct.

One question I have though: When I have a link on a page with multiple values in the querystring, the validator says that the ampersand should be encoded. I can't imagine this is correct in the link. Maybe in the text of the link, but not the link itself. But then again, I could be wrong.

For example, if I have this tag: <a href="mypage.htm?var1=123&var2=456">Click Here</a> the validator says that I should change it to: a href="mypage.htm?var1=123&amp;var2=456">Click Here</a>.

The links in both examples seem to work, but is the link really supposed to be HTML encoded?

Thanks...

2by4

3:13 am on Aug 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It's correct, the ampersand is a special character in valid HTML, it starts special character strings, like &amp;

Using it in the url makes no difference I've ever seen, and it's the only way to get real XHTML pages up that are valid. Also 4.01 strict I think if I remember right.