Thursday, October 1, 2009

Safari discards # anchor during 301 redirect

I filed a bug with Apple a few weeks ago about Safari dropping # anchors on redirects. It is problem ID #7209106. It doesn't seem like you can link to their bugs, so I will describe it here: When visiting a URL which causes a 301 redirect, the anchor at the end of the URL is discarded. Steps to Reproduce: Visit: Expected Results: The redirect to should result in Safari visiting: Actual Results: Safari discards the anchor, and the resulting page is: Regression: I did not try this with Safari 3 or earlier. But Chrome and Firefox both preserve the anchor. Notes: Here is the transaction with the server that is the redirect: GET /wiki/Safari_(web_browser) HTTP/1.1 Host: User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9 Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us Accept-Encoding: gzip, deflate Connection: keep-alive HTTP/1.0 301 Moved Permanently Date: Wed, 09 Sep 2009 01:12:23 GMT Server: Apache Location: Content-Length: 257 Content-Type: text/html; charset=iso-8859-1 Connection: keep-alive <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>301 Moved Permanently</title> </head><body> <h1>Moved Permanently</h1> <p>The document has moved <a href="">here</a>.</p> </body></html>