|
Posted by cwdjrxyz on 09/24/06 16:31
mouse@house.spam wrote:
> I have a reference to a web counter in my page, which according to my
> ISP should look like;
>
> <IMG SRC="/cgi-sys/Count.cgi?df=sigma-index.html&st=1000">
>
> However the W3 validator wails about the ampersand '&' before the st.
> It insists the line must look like;
>
> <img src="/cgi-sys/Count.cgi?df=c-compiler-com-root&ft=0&dd=D"
> title="Counter" alt="Counter">
>
> in other words we must use & instead of just &
>
> Is this how valid HTML must specify an ampersand? Both versions seem
> valid in my web browser. The & version looks a bit strange and I
> am surprised that W3 validator regards it as necessary.
If you click the "Help and FAQ" tab at the W3C validator, you get a
reference to a page that states:
_______________________________________________________________________
Another common error occurs when including a URL which contains an
ampersand ("&"):
<!-- This is invalid! --> <a
href="foo.cgi?chapter=1§ion=2©=3&lang=en">...</a>
This example generates an error for "unknown entity section" because
the "&" is assumed to begin an entity reference. Browsers often recover
safely from this kind of error, but real problems do occur in some
cases. In this example, many browsers correctly convert ©=3 to
©=3, which may cause the link to fail. Since ⟨ is the HTML entity
for the left-pointing angle bracket, some browsers also convert
&lang=en to <=en. And one old browser even finds the entity §,
converting §ion=2 to §ion=2.
To avoid problems with both validators and browsers, always use &
in place of & when writing URLs in HTML:
<a
href="foo.cgi?chapter=1&section=2&copy=3&lang=en">...</a>
Note that replacing & with & is only done when writing the URL in
HTML, where "&" is a special character (along with "<" and ">"). When
writing the same URL in a plain text email message or in the location
bar of your browser, you would use "&" and not "&". With HTML, the
browser translates "&" to "&" so the Web server would only see "&"
and not "&" in the query string of the request.
________________________________________________________________________
The url of the above is:
http://www.htmlhelp.com/tools/validator/problems.html#amp .
If you do not agree with the above, go to the W3C validator and click
the "feedback" tab. I am only the messenger :-) . There likely is
discussion of this in the official W3C specifications for html, but I
do not have time to check this tome at the moment.
Navigation:
[Reply to this message]
|