Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: POST links: hiding pages from crawlers without JavaScript (ianhenderson.org)
2 points by panic 6 days ago | hide | past | favorite | 2 comments





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.


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.



Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: