Easy fix:

JS doesn't let you change back button behaviour.

Q. But what about SPA?

A. Draw your own app-level back button top left of page.

Another solution: make it a permisson.

Yeah, no thanks. I want to use my browser’s standard keyboard shortcut to navigate back. And also forward again. And I want to be able to inspect the history listing before I go back or forward.

Let the browser do the browsery things. Don’t make SPAs suck even more than they already do.

So when you use a desktop app there is no back button but there is a switch to another app shortcut. Same idea.

There are desktop apps that do provide a navigation history (for example file managers, editors, chat apps), and they generally use the same keyboard and mouse operations as browsers for that. The point is that when an SPA does provide that within a browser, then the user shouldn’t suddenly have to use bespoke UI operations for it.

Can I preventDefault on mouse5? What about the physical back button on Android?

>Draw your own app-level back button top left of page.

This is the worst idea I’ve heard all day.

Why not just put up a fake captcha page? When the user clicks the link to continue, the back button is now hijacked.