Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> AJAX form submission with a redirect at the end, for example, is very common.

Why does that AJAX form need to pretend it's a link to a specific URL?

A button would have no problem, and a link that stays on the page would have no problem.



The trick works by cancelling the link click event and redirecting somewhere else in JS. The only way to prevent that would be to not allow any redirects in JS, including buttons.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: