Click here to get back home

ampersand in urls when using xhtml 1.0 strict

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
ampersand in urls when using xhtml 1.0 strict mark4asp 12-17-2007
Posted by mark4asp on December 17, 2007, 8:30 am
Please log in for more thread options
When I write a url in xhtml, with an unencoded ampersand, like this:

http://localhost:2063/Client/ViewReport.aspx?Ref=58&Type=SUMMARY

the xhtml sytax checker correctly indicates an error, telling me that
it should be:

http://localhost:2063/Client/ViewReport.aspx?Ref=58&Type=SUMMARY

see: <http://www.htmlhelp.com/tools/validator/problems.html#amp>

However the last sentence there ends:

        "the browser translates "&amp;" to "&" so the Web server would only
see "&" and not "&amp;" in the query string of the request."

My web server is clearly seeing &amp; and the browser (FF 1.0.0.11) is
also showing &amp; in the url.

I am using:
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

with no xml prefix because, as we all know, IE6 breaks when the xml
prefix is present.

What is the cause and solution of this problem.

I am using FF 1.0.0.11, via a local asp.net 2.0 site through the mini
webserver (Cassini) on WinXP SP2 with all latest o/s updates installed
(apart from IE7, I am using IE6 on this PC).

Do I have to apply a url decode algorithm when the web page loads?
That is far from ideal because the problem here is that the browser is
not showing the decoded url.

Is this a bug in FF?

Finally is there a DOCTYPE I can use to force all the 5 major browsers:
IE6, IE7, FF, Opera, Safari to all render in strict mode when
displaying xhtml?

Posted by Harlan Messinger on December 17, 2007, 9:04 am
Please log in for more thread options
mark4asp wrote:
> When I write a url in xhtml, with an unencoded ampersand, like this:
>
> http://localhost:2063/Client/ViewReport.aspx?Ref=58&Type=SUMMARY
>
> the xhtml sytax checker correctly indicates an error, telling me that
> it should be:
>
> http://localhost:2063/Client/ViewReport.aspx?Ref=58&amp;Type=SUMMARY
>
> see: <http://www.htmlhelp.com/tools/validator/problems.html#amp>
>
> However the last sentence there ends:
>
>         "the browser translates "&amp;" to "&" so the Web server would only
> see "&" and not "&amp;" in the query string of the request."
>
> My web server is clearly seeing &amp; and the browser (FF 1.0.0.11) is
> also showing &amp; in the url.
>
> I am using:
>         <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>
> with no xml prefix because, as we all know, IE6 breaks when the xml
> prefix is present.
>
> What is the cause and solution of this problem.
>
> I am using FF 1.0.0.11, via a local asp.net 2.0 site through the mini
> webserver (Cassini) on WinXP SP2 with all latest o/s updates installed
> (apart from IE7, I am using IE6 on this PC).

You're using 1.0.0.11? The bug is that it's practically the very first
version released and it was superseded by 1.0.1 within a couple of
months, by 1.5 over two years ago, and by 2.0 over a year ago. Based on
usage of the high-traffic site I'm involved with, virtually no one is
using Firefox 1.x any more (probably because Firefox prompts you to
update it), and you *certainly* shouldn't be doing anything with a
version that has been outdated over ten times as long as the product had
existed when the version was replaced.
>
> Do I have to apply a url decode algorithm when the web page loads?
> That is far from ideal because the problem here is that the browser is
> not showing the decoded url.
>
> Is this a bug in FF?

There is no problem with this whatsoever in Firefox 2, I can tell you
that. Use &amp; in your links and images and so forth and it'll work.

Posted by mark4asp on December 17, 2007, 12:43 pm
Please log in for more thread options
Harlan Messinger wrote:

> mark4asp wrote:
> > When I write a url in xhtml, with an unencoded ampersand, like this:
> >
> > http://localhost:2063/Client/ViewReport.aspx?Ref=58&Type=SUMMARY
> >
> > the xhtml sytax checker correctly indicates an error, telling me
> > that it should be:
> >
> > http://localhost:2063/Client/ViewReport.aspx?Ref=58&amp;Type=SUMMARY
> >
> > see: <http://www.htmlhelp.com/tools/validator/problems.html#amp>
> >
> > However the last sentence there ends:
> >
> >         "the browser translates "&amp;" to "&" so the Web server would only
> > see "&" and not "&amp;" in the query string of the request."
> >
> > My web server is clearly seeing &amp; and the browser (FF 1.0.0.11)
> > is also showing &amp; in the url.
> >
> > I am using:
> >         <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> >
> > with no xml prefix because, as we all know, IE6 breaks when the xml
> > prefix is present.
> >
> > What is the cause and solution of this problem.
> >
> > I am using FF 1.0.0.11, via a local asp.net 2.0 site through the
> > mini webserver (Cassini) on WinXP SP2 with all latest o/s updates
> > installed (apart from IE7, I am using IE6 on this PC).
>
> You're using 1.0.0.11? The bug is that it's practically the very
> first version released and it was superseded by 1.0.1 within a couple
> of months, by 1.5 over two years ago, and by 2.0 over a year ago.
> Based on usage of the high-traffic site I'm involved with, virtually
> no one is using Firefox 1.x any more (probably because Firefox
> prompts you to update it), and you certainly shouldn't be doing
> anything with a version that has been outdated over ten times as long
> as the product had existed when the version was replaced.

Apologies, a typo. I am using FF 2.0.0.11

> > Do I have to apply a url decode algorithm when the web page loads?
> > That is far from ideal because the problem here is that the browser
> > is not showing the decoded url.
> >
> > Is this a bug in FF?
>
> There is no problem with this whatsoever in Firefox 2, I can tell you
> that. Use &amp; in your links and images and so forth and it'll work.

So exactly what should happen.

If I have, say:
        <a href="../page1.aspx?a=1&amp;b=gonow">Go Now</a>
in my html, on clicking the link, will FF give :
        blah blah/page1.aspx?a=1&b=gonow
in the address bar?

It's not doing that for me. It gives
        blah blah/page1.aspx?a=1&amp;b=gonow

Which the server reads and tells me that it can't get my querystrings.
I suppose I can url decode this at the server end to fix it.



Posted by Chris Morris on December 17, 2007, 12:49 pm
Please log in for more thread options
> Which the server reads and tells me that it can't get my querystrings.
> I suppose I can url decode this at the server end to fix it.

The easy way out is to allow ';' as well as '&' as a separator. Most
web languages/CGI libraries support this either by default or as an
option.

--
Chris

Posted by Martin Honnen on December 17, 2007, 12:51 pm
Please log in for more thread options
mark4asp wrote:

> If I have, say:
>         <a href="../page1.aspx?a=1&amp;b=gonow">Go Now</a>
> in my html, on clicking the link, will FF give :
>         blah blah/page1.aspx?a=1&b=gonow
> in the address bar?
>
> It's not doing that for me. It gives
>         blah blah/page1.aspx?a=1&amp;b=gonow

Can you post a URL where that happens?

--

        Martin Honnen
        http://JavaScript.FAQTs.com/

Similar ThreadsPosted
utf-8 and xhtml 1.0 strict October 28, 2004, 7:26 am
xhtml vs html 4 strict May 21, 2005, 5:23 pm
Strict XHTML and div question July 14, 2005, 7:07 pm
XHTML 1.0 Strict and the Apostrophe February 15, 2008, 11:12 am
What to use intead of taget_new in XHTML/Strict July 19, 2004, 7:41 am
image maps + xhtml strict October 23, 2004, 9:16 pm
Valid XHTML strict messed up in IE Mac December 20, 2004, 7:13 pm
XHTML 1.0 Strict validation problem November 11, 2005, 10:30 am
HTML 4.01 strict / transitional vs. XHTML 1.0 September 18, 2005, 3:10 pm
Validation: XHTML Transitional vs. HTLM 4.01 Strict July 23, 2004, 6:10 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap