(Ticket #3808) ajax: $().load() fails 404 if there is a hash in the url

(Ticket #3808) ajax: $().load() fails 404 if there is a hash in the url


For kicks, I've been looking into the causes behind the problem this
ticket poses. I've managed to duplicate the error in the test script
that the ticket poster provided (http://pixeline.be/experiments/
jquerybeta/test2.html).
Essentially, the problem is that Ajax GET requests (haven't tried with
POST) to a URL which happens to include an anchor ('#') consistently
fail with HTTP 404 status errors (Document Not Found) in Internet
Explorer (tested with 7.0.5730.13), while these same requests are
processed just fine in Firefox 3, Chrome, et al.
After putzing around a bit, I noticed something interesting. When I
ran the test case in Internet Explorer, my Apache error log displayed
the following error:
[Tue Mar 03 15:59:30 2009] [error] [client ***.**.**.**] File does not
exist: /<path to web-server>/dummy.html#love, referer: ...
I did not get this error with the other browsers that successfully
execute the call to load().
Case in point, it seems that, with the IE ajax request, the anchor
(and anchor name) is not correctly parsed out of the base document's
file name when it is served. This would be akin to a web server
receiving a get request for webPage.html with parameters foo=bar and
searching for a document on the local file-system named '/apache/
htdocs/webPage.html?foo=bar'. Obviously any query strings (or in this
case, anchor data) should be removed from the URL before this point.
I would argue, however, that these anchors have no place in Ajax
requests to begin with, as the entire dummy.html document will be
retrieved and returned in the Ajax response, thus eliminating the need
for an anchor tag. However, I would propose that the jQuery Ajax
component could be extended to parse out any erroneous anchor tags
from request URLs so that this is no longer a problem in the future.
- Gavin
(I apologize if I seem overly verbose, just want to get the facts out)