Remix.run Logo
mlmonkey 12 hours ago

But the question is: why are sites allowed to hijack the Back Button?!?

josephcsible 12 hours ago | parent | next [-]

So that in single-page applications, it can work intuitively instead of always taking you all the way out of the app.

phkahler 3 hours ago | parent | next [-]

>> So that in single-page applications, it can work intuitively instead of always taking you all the way out of the app.

Just implement an additional back button on the SPA. This is actually not confusing and is done in some places. Navigation buttons within an SPA are common enough.

not2b 12 hours ago | parent | prev [-]

If the navigation simulates what would happen if we follow links to SPA#pos1, SPA#pos2, etc so that if I do two clicks within the SPA, and then hit Back three times I'm back to whatever link I followed to get to the SPA, I guess it's OK and follows user expectations. But if it is used as an excuse to trap the user in the SPA unless they kill the tab, not OK.

bonesss 11 hours ago | parent | next [-]

From the browsers perspective those are the same thing though. It’s a paradigm boundary.

The real answer is to have desktop applications that work like applications (buttons do what feels right), and websites that work like websites.

SPA, is a page application. Pages aren’t applications, applications aren’t pages. AutoCAD is an app, the Robotech Encyclopedia is content.

lxgr 5 hours ago | parent [-]

> From the browsers perspective those are the same thing though.

If the browser only allows adding at most one history item per click, I should be able to go back to where I entered a given site with at most that many back button clicks.

At a first glance, this doesn't seem crazy hard to implement? I'm probably missing some edge cases, though.

mock-possum 12 hours ago | parent | prev [-]

Of course, but programmatically, how do you enforce that?

JoshTriplett 11 hours ago | parent [-]

Some browser APIs (such as playing video) are locked behind a user interaction. Do the same for the history API: make it so you can't add any items to history until the user clicks a link, and then you can only add one.

That's not perfect, and it could still be abused, but it might prevent the most common abuses.

EDIT: apparently Chrome tried that and it wasn't sufficient: https://news.ycombinator.com/item?id=47761349

filcuk 12 hours ago | parent | prev [-]

Because it has a legitimate use. As anything, the tools will be abused by malicious actors