Show HN: POST links: hiding pages from crawlers without JavaScript

(ianhenderson.org)

2 points | by panic 6 days ago ago

3 comments

  • mubou 6 days ago ago

    Interesting use of formaction on a button. One suggestion: put role="link" on it so it appears as a link to screen readers as well.

    Unfortunately, by using a button you can't right click to copy the URL or open in a new tab/window. Middle clicking doesn't work either, although that could be fixed with JS. The URL also doesn't show up in the bottom left when hovering.

    Edit: One thing you could do if you don't mind making your site JS-only is intercept link clicks and trigger a form POST instead, so the links are all normal links that respect default browser behavior, but the requests are all made as POSTs. Though honestly it's a losing battle, trying to stop bots; I've largely given up. You also have to consider what happens when someone shares the URL or bookmarks it, or tried to reload the page.

    • panic 6 days ago ago

      Thanks, I've updated it to include role='link'. I do agree that it's probably a losing battle, but I thought I'd write up this idea anyway in case it was useful to anyone as a mitigation.

  • undefined 6 days ago ago
    [deleted]