Hacker News new | past | comments | ask | show | jobs | submit login

Sadly that's a common problem with single-page apps and modern web front end.

It's trivial to implement but many devs don't pay attention to those things.




People underestimate the value in functionality and consistency that native interfaces provide.

It is also partially the web's fault. There isn't an easy way to detect an "in-page" navigation. The best solution I am aware of is:

1. Add global "click" listener. 2. Check that the click target was an `a` tag. 3. Check that the click was a single left click with no modifiers. 4. Check that the `href` points to a page that you can render. 5. Call event.preventDefault() and handle the navigation yourself.

But step 3 isn't even sufficient as people can configure their browsers to open all links in new windows or tabs.


> But step 3 isn't even sufficient as people can configure their browsers to open all links in new windows or tabs.

You know many people that do that?

I do that for search results and Reddit but I don't want that behavior for all websites.


I don't know about many but I do something similar. I make all links open in the same tab. Then if I want another tab I can middle click. This way I can decide where links open, not the website owner.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: