Behaviour of external links for not logged-in visitors

I selected the setting default_external_links_in_new_tab in the admin area. This resulted in the expected behaviour of setting default preference of all new users set to ‘open external links in new tab’.

However, for non-logged-in visitors, the behaviour is still the old one, it is opening the external links in the same tab leading visitors to go away from the website. When admin selects the default_external_links_in_new_tab setting, it should change the behaviour for non-logged-in visitors as well.

4 Likes

Any update on this issue? Anything I can do to fix this locally?

The default_external_links_in_new_tab setting was added relatively recently. Before that, only end users could change this via their user preferences.

I am guessing the issue is that when that setting was added, it was implemented such that when a new user is created, their initial preference is set.

But the logic still holds that the setting is only effective for the current user via their preferences.

This may or may not have been a conscious decision, so I think you should recategorize this topic as a “feature” request.

1 Like

I knocked together a quick PR:

The ‘false’ behavior was from acting on an undefined value returned from Discourse.User.currentProp() when there is no current user, so it seemed to me to not be intentional one way or the other.

4 Likes

Non logged in users still not able open external links on new tab.

Is there any update plan on that?

Is this feature available yet?

@riking what is going on here?

We still have the problem behavior mentioned in the OP.

pr-welcome here, I do not think this is bug proper, rather expanded functionality for anon.

3 Likes

I would think it’s useful for anon/guests to open external in tabs… might lose traffic here because they bounce following a link in a topic.