Page MenuHomePhabricator

Keep given anchor on Special:PermanentLink
Closed, InvalidPublic

Description

Please keep the given anchor on Special:PermanentLink.

The wikilink [[Special:PermanentLink/1#test]] gives
/w/index.php?oldid=1
better is
/w/index.php?oldid=1#test

Thanks.


Version: 1.18.x
Severity: normal

Details

Reference
bz32085

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:03 AM
bzimport set Reference to bz32085.
bzimport added a subscriber: Unknown Object (MLST).

Seems to work for me...

When I follow https://en.wikipedia.org/wiki/Special:PermanentLink/1#test I end up at https://en.wikipedia.org/w/index.php?oldid=1#test

Same seems to work on a local wiki install, both trunk and 1.18.

Tested in Firefox 7.0.1.

I am using IE8, but works in Firefox 4.0 on my machine.

I can confirm that IE8 on WinXP behaves as described above (drops the Trash).

Looking at the code for Special:PermanentLink it looks like the replacement of the Trash is actually something that Firefox is doing explicitly in the browser side...

Hash fragments are not actually sent to the server, so the server-side processing has no way to know if there is one or not. It just empties out the existing parameters and replaces them with an 'oldid' param set to whatever the subpage parameter was.

So when you go to http://en.wikipedia.org/wiki/Special:Permalink/1#test

MediaWiki sees that you went to "/wiki/Special:Permalink/1". It sends you back to "/wiki/index.php?oldid=1".

Your browser may then be smart enough to say "maybe you wanted to keep that Trash on the redirected URL?" and add it on... but MediaWiki never saw it in the first place.

Only way to fix this as a general case I can think of would be to redo it to run the redirect through JavaScript instead of as an HTTP redirect; client-side JavaScript could detect the fragment on document.location and preserve it when navigating over to the target page.

(In reply to comment #3)

Only way to fix this as a general case I can think of would be to redo it to
run the redirect through JavaScript instead of as an HTTP redirect; client-side
JavaScript could detect the fragment on document.location and preserve it when
navigating over to the target page.

*twitch* please no, not JavaScript...

A media: style special case where the parser sees Special:Permalink and a # and gives the /index.php url directly would be a tolerable hack if the alternative is turning a HTTP redirect into a page that uses JS.

The browser (IE8) is not showing the anchor, but jumping to the section, so all is good.