Hacker News new | ask | show | jobs
by Dylan16807 1428 days ago
> 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.

1 comments

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.