Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > & in links

Reply
Thread Tools

& in links

 
 
Matthew
Guest
Posts: n/a
 
      07-01-2004
I just ran a HTML validator on one of my web sites. It said that the
following is invalid:
<A HREF="products.cfm?type=Specialty&id=8">
and should be written:
<A HREF="products.cfm?type=Specialty&amp;id=8">

Does anybody know how serious this is?
Also, I am considering putting the following line at the top of every page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

Will this affect the decision about &amp; in links?

Thanks in advance,

Matthew



 
Reply With Quote
 
 
 
 
Steve Pugh
Guest
Posts: n/a
 
      07-01-2004
"Matthew" <(E-Mail Removed)> wrote:

>I just ran a HTML validator on one of my web sites. It said that the
>following is invalid:
><A HREF="products.cfm?type=Specialty&id=8">
>and should be written:
><A HREF="products.cfm?type=Specialty&amp;id=8">
>
>Does anybody know how serious this is?


Do you want valid code or not? If you do then you should change it.

>Also, I am considering putting the following line at the top of every page:
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
>"http://www.w3.org/TR/html4/strict.dtd">
>
>Will this affect the decision about &amp; in links?


No.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <(E-Mail Removed)> <http://steve.pugh.net/>
 
Reply With Quote
 
 
 
 
Eric B. Bednarz
Guest
Posts: n/a
 
      07-01-2004
"Matthew" <(E-Mail Removed)> writes:

> I just ran a HTML validator on one of my web sites. It said that the
> following is invalid:
> <A HREF="products.cfm?type=Specialty&id=8">


Try a reference to a declared entity, eg

<A HREF="products.cfm?type=Specialty&copy=2004">

> and should be written:
> <A HREF="products.cfm?type=Specialty&amp;id=8">
>
> Does anybody know how serious this is?


If you try the above, you'll see that it is valid but perhaps not just
what you expected; this issue has been discussed until the cows came
home. Try Google.

> Also, I am considering putting the following line at the top of every page:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd">


Fine. Why?

> Will this affect the decision about &amp; in links?


No. Thanks to doctype sniffing bogosity it is not quite impossible that
UA behaviour might differ when parsing URI references with undeclared or
existing entities, though.


--
| ) 111010111011 | http://bednarz.nl/
-(
| ) Distribute me: http://binaries.bednarz.nl/mp3/aicha
 
Reply With Quote
 
Neal
Guest
Posts: n/a
 
      07-02-2004
On Thu, 1 Jul 2004 16:58:42 -0400, Matthew <(E-Mail Removed)>
wrote:

> ... I am considering putting the following line at the top of every page:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd">
>


What's to consider? To code HTML 4.01 strict you need that to gain the
benefit of quirk-less rendering.
 
Reply With Quote
 
DU
Guest
Posts: n/a
 
      07-03-2004
Steve Pugh wrote:
> "Matthew" <(E-Mail Removed)> wrote:
>
>
>>I just ran a HTML validator on one of my web sites. It said that the
>>following is invalid:
>><A HREF="products.cfm?type=Specialty&id=8">
>>and should be written:
>><A HREF="products.cfm?type=Specialty&amp;id=8">
>>
>>Does anybody know how serious this is?

>
>
> Do you want valid code or not? If you do then you should change it.
>


I'd like to reply to this. I entirely agree with the purpose of writing
entirely valid code as much as possible (if not always) but...
I was once asked why+how not writing &amp; in an uri would affect a
webpage, would cause problems or bugs or anything and I couldn't come up
with an answer. It seems that almost no matter how you write an uri,
browsers succeed in overcoming this very very frequent validation error.
I am just wondering, like I was asked, how this error affects webpages
or affects browsers. There must be somewhere a problem caused by not
escaping ampersand characters and/or there must be a benefit somehwere
for escaping, converting ampersand characters into &amp;: so, what is it?

DU

>
>>Also, I am considering putting the following line at the top of every page:
>><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
>>"http://www.w3.org/TR/html4/strict.dtd">
>>
>>Will this affect the decision about &amp; in links?

>
>
> No.
>
> Steve
>

 
Reply With Quote
 
Steve Pugh
Guest
Posts: n/a
 
      07-03-2004
DU <(E-Mail Removed)> wrote:
>Steve Pugh wrote:
>> "Matthew" <(E-Mail Removed)> wrote:
>>
>>>I just ran a HTML validator on one of my web sites. It said that the
>>>following is invalid:
>>><A HREF="products.cfm?type=Specialty&id=8">
>>>and should be written:
>>><A HREF="products.cfm?type=Specialty&amp;id=8">
>>>
>>>Does anybody know how serious this is?

>>
>> Do you want valid code or not? If you do then you should change it.

>
>I'd like to reply to this. I entirely agree with the purpose of writing
>entirely valid code as much as possible (if not always) but...
>I was once asked why+how not writing &amp; in an uri would affect a
>webpage, would cause problems or bugs or anything and I couldn't come up
>with an answer. It seems that almost no matter how you write an uri,
>browsers succeed in overcoming this very very frequent validation error.
>I am just wondering, like I was asked, how this error affects webpages
>or affects browsers. There must be somewhere a problem caused by not
>escaping ampersand characters and/or there must be a benefit somehwere
>for escaping, converting ampersand characters into &amp;: so, what is it?


What happens if the sequence following the & is a character entity
reference? The browser will convert that to the relevant character,
thus changing the URL.

<a href="script.cgi?id=234&prod=234&sect=234"> looks like a perfectly
sound URL but as &prod and &sect are both HTML 4 character entity
references it's actually a different URL.

Can you remember all the character entity references and avoid using
them as parameter names? Easier and safer to write &amp;.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <(E-Mail Removed)> <http://steve.pugh.net/>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Update to FAQ - Relative URLs for In-page Links and Links to Notes Garrett Smith Javascript 14 05-26-2009 04:50 PM
FF Crashes on Links within Links Puma Firefox 10 02-17-2009 07:12 PM
Make A Shorter Link - no new links accepted, old links still work. why? Computer Support 7 01-02-2007 09:45 PM
Site Links and Physical WAN Links =?Utf-8?B?RW5mb1BhdWw=?= MCSE 2 03-22-2005 09:23 AM
Exchange Links < Western Cartoon Cards > Exchange Links www.westerncartooncards.ca HTML 2 07-12-2004 07:59 PM



Advertisments