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: http://wikipedia.org/wiki/Safari_(web_browser)#Safari_4 Expected Results: The redirect to en.wikipedia.org should result in Safari visiting: http://en.wikipedia.org/wiki/Safari_(web_browser)#Safari_4 Actual Results: Safari discards the anchor, and the resulting page is: http://en.wikipedia.org/wiki/Safari_(web_browser) 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: wikipedia.org 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: http://en.wikipedia.org/wiki/Safari_(web_browser) 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="http://en.wikipedia.org/wiki/Safari_(web_browser)">here</a>.</p> </body></html>