Pony request: fix anchors for Safari? October 2, 2021 12:22 AM   Subscribe

I noticed recently that page anchors on MeFi were no longer working on iOS if opened in a new tab. Any links to specific comments just don’t work - the page loads, but I’m placed at the top, not the comment itself. It appears to be a known quirk with a usable solution. Can this be fixed?

Per this StackOverflow post, Safari strips (or ignores) the page anchors when entered normally (e.g. page.html#anchor), and importantly, within a single tab, it works JUST FINE as entered - Safari only screws it up when you open the link in a new tab. It’s not a MeFi bug, it’s a Safari rendering quirk, hence the pony request.

The new tab fix is pretty simple but would require a rewrite rule on the server, because people won’t know to do it when adding page links. Specifically, you can get Safari to interpret new tab links correctly if you add a forward slash (e.g. page.html/#anchor). I’ve tested this on a MeFi deep link, and yes, adding the slash to the URL does get Safari to the right comment. (The URL is passed to browser correctly in new tabs, it just ignores the anchor, so I am able to manually add the slash and reload but this is a PITA.)

Is this possible? iOS users would appreciate it…
posted by caution live frogs to Feature Requests at 12:22 AM (9 comments total) 3 users marked this as a favorite

Arrrrgh, matey! To reset the anchor you've must to set the long boats to pulling your vessel over to the new anchorage, after of course shipping her in the first place. A good piece of work for a morning. And what when the wind shifts? Or the tide runs? Can you be sure the new anchorage will be better than where you were? Aye, there are not a few significant issues to consider when setting your anchor, much less for the re-setting of it.

No small matter at all.
posted by From Bklyn at 11:51 AM on October 2, 2021 [4 favorites]


This happens to me sometimes in Firefox for Android.
posted by under_petticoat_rule at 5:58 PM on October 2, 2021


I think I've noticed something similar if I follow a link and hit back; tapping the location and hitting Return usually works for me.
posted by Pronoiac at 10:48 PM on October 2, 2021


I contacted the mods about this when I couldn't (and still can't) comment on MeFi from Safari. The comment box just utterly disappears. I logged out and logged back in as per their suggestion and nope, it still doesn't work. Alas, I shall have to save my comments for when I am at my laptop.
posted by Kitteh at 6:50 AM on October 4, 2021


Kitteh, maybe try all the different themes in Preferences?
posted by Pronoiac at 9:39 AM on October 4, 2021


As I understand it, Safari strips fragment identifiers (the part of the URL after the # sign) when the server sends an HTTP Redirect response. The mitigations discussed on Stack Overflow are designed to avoid such redirects, but whether they work will depend on what is actually causing the redirect.

For example, many servers will redirect a link "http://example.com/foo" to "http://example.com/foo/". When this is the case, you can avoid the redirect by changing the link to include the slash. However, this is not the case for links to MetaFilter posts, so adding a slash will not help here.

When I open a comment permalink in a background tab in mobile Safari, the behavior I'm seeing is different from the one discussed in the Stack Overflow post. Safari isn't stripping the fragment identifier. The link in the address bar is still correct, and the targeted comment is highlighted with an arrow in the left margin, as usual. Safari just doesn't scroll to the location of the fragment for some reason. This seems to be a different Safari bug, but I haven't been able to find any more information or workarounds for it.
posted by mbrubeck at 10:56 AM on October 6, 2021 [1 favorite]


This feels like something that could also be solved by a userscript that scans the page for links with fragment identifiers and adds the slash, if this isn't something that gets picked up as an official feature.
posted by Aleyn at 12:06 PM on October 8, 2021


I contacted the mods about this when I couldn't (and still can't) comment on MeFi from Safari. The comment box just utterly disappears.

I have the same problem on my iPhone, but not on my iPad. I just upgraded from an X to a 13 and the problem is still there. My husband does not have the issue, so I assume I have some kind comment blocker installed.
posted by soelo at 2:08 PM on October 10, 2021


Note, I mentioned switching the themes because I noticed it worked for me as a workaround on a previous issue, about the comment box becoming read-only if, say, you tapped the link button and canceled.
posted by Pronoiac at 3:06 PM on October 10, 2021


« Older [MeFi Site Update] September 27th   |   Metatalktail Hour: Thank Goodness for MeFi Newer »

You are not logged in, either login or create an account to post comments