|
Posted by mark4asp on December 17, 2007, 12:23 pm
Please log in for more thread options Harlan Messinger wrote:
> mark4asp 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&Type=SUMMA
> > > RY
> > >
> > > see: <http://www.htmlhelp.com/tools/validator/problems.html#amp>
> > >
> > > However the last sentence there ends:
> > >
> > > "the browser translates "&" to "&" so the Web server would
> > > only see "&" and not "&" in the query string of the request."
> > >
> > > My web server is clearly seeing & and the browser (FF
> > > 1.0.0.11) is also showing & 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?
> >
> > The immediate problem is now fixed. Somehow the page with the urls
> > was missing a Content-Type header:
> > <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
> > />
> >
> > After including this header I was able to remove the encoded
> > ampersands, [ & ], to replace them with just a &. The xhtml
> > syntax checker no longer indicated errors here and the page
> > navigation now works.
>
> First, this is very strange because if your browser was displaying
> the page as HTML, then it was already receiving a content type header
> from the web server (which the web server should always send--the
> META tag should only be useful for cases where the server isn't
> sending a content type header or when you are opening up a static web
> page directly on your system instead of requesting it from a web
> browser) telling it that the page was HTML, or else there was no
> header and the browser was treating it as HTML by default.
>
> Second, this is very strange because NOT encoding ampersands is
> invalid and the W3C validator wouldn't start treating it as valid
> because you included a META tag that wasn't necessary anyway and that
> wouldn't cause the effect that you've stated.
OK. I didn't check validity using the W3C. I used an Add-on available
for Firefox [HTML validator 0.8.4.0]. I have just now discovered the
Total Validator Add-on, so I will install that too and check again.
But in any case, if my urls have an & why is FF giving the & to
the server [Is it a bug?]. It clearly states in the W3C documentation
that the & is to be converted by the browser so that an & shows in
the address bar
|