Please don't automatically open links in new tabs

I know this is something that gmail, facebook, etc. love to do, but it’s really annoying when web pages break the default behavior of my browser which is to open links directly in the same view, and then let me return with the back button. If I want a link in a new tab, I can command-click or whatever as appropriate for the platform.

In particular, it’s ridiculous to have anchor links to within the same notebook open up new tabs instead of just scrolling up/down the page to the appropriate section.

1 Like

I only agree about anchors. I hate to accidentally lose tabs I’m working in because I clicked the a link which exits it, and I think Observable (and gmail and facebook) usually make the right judgment about it.

1 Like

We don’t open links in new windows. The default target is _top: top-level navigation in the same window.

However, Safari does not yet support the allow-top-level-navigation-by-user-activation sandbox flag, and so it does not allow top-level navigation and instead opens a new window.

We currently fallback to allow-top-level-navigation for Firefox (which is less safe, since it allows a notebook to trigger top-level navigation without the user clicking on anything). Perhaps we should also enable this for Safari. Unfortunately, as far as I am aware, there is no way to detect whether a browser supports this feature.

1 Like

Oh interesting. So in Safari (or at least previous versions…?), sandboxed iframe links can only open in new tabs, as a security feature? That’s frustrating. Thanks for the explanation.

Is there any way around even for anchor links? Or do we just need to wait for browser support?