ndmitchell / hoogle

Haskell API search engine
http://hoogle.haskell.org/
Other
738 stars 134 forks source link

Hash sections of links are broken in different browsers #81

Open nickserv opened 10 years ago

nickserv commented 10 years ago

I am on Mac OS 10.7.5. This behavior seems odd, so let me know if any extra information would be useful.

Firefox 31 and Chrome 36

Searching for a function with symbol characters results in a link with a hash portion that seems to be corrupted, and doesn't jump to the right part of the page.

Example

Search for (.) and click on the first result. The URL bar displays http://hackage.haskell.org/package/base-4.7.0.1/docs/Prelude.html#v:-46-, which does not jump to the appropriate section.

Safari 6

The hash sections of links seem to never work and be removed in redirects.

Example

Search for map and click on the first result. The URL bar doesn't have a hash section in the URL after the redirects.

ndmitchell commented 10 years ago

So Haddock escapes symbols, e.g. =<< becomes #v:-61--60--60-. Either it used to escape ., or it never did and this bug has always been present. That should be easy to fix. It should only impact on functions with . in their name, which is relatively few.

For Safari, I can replicate your bug on the Windows version of Safari. If I tend http://hackage.haskell.org/packages/archive/base/latest/doc/html/Prelude.html#v:map as the URL I don't go to the right place, but if I enter http://hackage.haskell.org/package/base-4.7.0.1/docs/Prelude.html#v:map then I do. Hackage does a permanent redirect (to the new docs location) followed by a temporary redirect (to the -4.7.0.1 version). I think this is a bug in Safari that temporary redirects don't keep their anchors. No idea how to work around that - any ideas? It does work on iOS.

nickserv commented 10 years ago

I found the WebKit bug for this, which seems to still not be fixed. Would it be ideal if Hoogle tried to provide links that wouldn't need to redirect? The redirect-free versions of the links could be used by default, or an HTTP client could be used on the server to check if the link it's about to display has a redirect and resolve it on the server side, before it is sent to the user.