4 ms·
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 t
by kevincox 7y ago
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.
- pier25 7y ago> 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.
- kevincox 7y agoI 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.