Forum Moderators: open

Message Too Old, No Replies

Unescaped ampersand in links

use & instead?

         

LunaC

4:54 pm on May 8, 2006 (gmt 0)

10+ Year Member



My pages validated as strict untill I removed the outbound tracking links. Now a few are showing validation errors on links with urls that contain &.

Should I edite these urls to use &, is there a better way?

Demaestro

4:58 pm on May 8, 2006 (gmt 0)

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



I would go with the &

mcvoid

5:03 pm on May 8, 2006 (gmt 0)

10+ Year Member



I had the same thing when I validated my page. I changed it to & and it validated just fine. I find that it only happens when validating in XHTML Strict.

Fotiman

5:38 pm on May 8, 2006 (gmt 0)

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



Yes, you should be using & in your URLs. From the HTML spec [w3.org]:


The URI that is constructed when a form is submitted may be used as an anchor-style link (e.g., the href attribute for the A element). Unfortunately, the use of the "&" character to separate form fields interacts with its use in SGML attribute values to delimit character entity references. For example, to use the URI "http://host/?x=1&y=2" as a linking URI, it must be written <A href="http://host/?x=1&#38;y=2"> or <A href="http://host/?x=1&amp;y=2">.

LunaC

7:11 pm on May 9, 2006 (gmt 0)

10+ Year Member



OK, Thank you very much for your help.

apprentice

9:00 pm on May 12, 2006 (gmt 0)

10+ Year Member



My StatCounter code which initially contained several unescaped ampersands also gave me validation errors in my 4.01 HTML Strict. After I replaced them with &amp; the validator stopped complaining. I also tested the tracker and it seemed to be working fine, so yes, you are good to replace them.

Regards.