Links to uploads should follow “Open all external links in a new tab” setting

AI-generated summary

jesus2099 reports that links to uploaded files (e.g., images, PDFs) on Discourse — such as those under /uploads/ — do not respect the user setting “Open all external links in a new tab,” even though they break Discourse navigation by replacing the current tab. This causes users to lose context and forces a full page reload when using the Back button. nat agrees and moves the issue to #feature for future consideration. jesus2099 clarifies the bug applies to all uploads, not just PDFs, and demonstrates with a PNG link that opens in-place, disrupting the browsing experience. Ethsim2 initially questions whether navigation loss is real, but later agrees that uploads — whether on CDN or local server — should open in new tabs, and supports the feature request. They also note that PDFs currently download instead of opening inline or in new tabs, suggesting an option should exist. jesus2099 reiterates the core issue: any link that leaves Discourse context should open in a new tab, regardless of upload type or performance factors. The discussion concludes with Ethsim2 expressing hope the feature gains traction to improve user experience, especially compared to mobile apps like Moodle’s.

Continuing the discussion from External links in history don’t follow “Open all external links in a new tab” setting:

I have found another instance where I would have expected the link to open in new tab.

  1. Have the “Open all external links in a new tab” setting enabled in your user preferences
  2. Go to this post
  3. Click any of the 3 links

These links break the Discourse browsing as they are links to attached/uploaded files, kind of technical folders (/uploads/…, etc.), not to regular Discourse pages (/t/…, /u/…, etc.)

They are not really external links but they are not normal Discourse browsing pages, either.
So maybe not a Contribute > Bug…

1 Like

You are right.

I’m gonna just move this to Contribute > Feature and we visit this again if it hits critical mass.

2 Likes

It happened to me once more, when I clicked the [screenshot] links over there.

Could this be related to if you have to open an uploaded PDF in PWA, to exit the PDF you need to Exit the PWA entirely

this is a mobile issue however, on Desktop i let the PDF download, and use Inline PDF Previews

before then i used Discourse send PDF inline

This bug is not only with PDF.

Please try the first example 3 jpeg links. They don’t open new tabs, but you lose Discourse context and navigation.

It’s even better to test on this very forum (meta):

This PNG link* does not open in a new tab (this is the bug).

But you still lose Discourse context and navigation, unexpectedly, so I think it should be treated like an external link.

* Manually copied from this post

i don’t think in cases apart from the PWA (Progressive Web App), you do lose navigation

I don’t use PWA, I don’t know what it is, exactly.

My bug report is for the regular use of (meta) Discourse website.

The “Open all external links in a new tab” option is there to make sure that all pages that are outside of (meta) Discourse navigation (menus), will open in a new tab.

Leaving the original tab with the (meta) Discourse page you were at.

Here, after I click this image link, when I hit the “Back” button, I will have to wait that Discourse website reloads entirely (and cross fingers so that it ends up on the same previous post, not the case here):

It should have opened in a new tab, like this other random external link.

Raw link for clarity

[this image link](https://meta.discourse.org/uploads/short-url/7QvdJ5fFitnZQCIyNJZjmeC6efL.png)
1 Like

89% sure this is because of throttling from your 4G provider, 1% sure it’s due to the CDN that meta are using

  • leaving a spare 10% because France is much bigger than the UK and overall 4G reception might be worse than i realise

It’s just because I’m out of Discourse in the same tab.

No problems hitting “Back” when inside Discourse.
No reloading.

It’s the whole point of my bug report: when sent out of Discourse, it should be in a new tab.

My bug report is not about PDF, PWA nor about slow Discourse initial loading. :wink:

I see, i opened another image on meta that was on CloudFront. I realise any upload whether on CDN/S3

or the server itself,

i also realise the bug from my own instance’s local uploads.

should be loaded in another tab.


I have voted on your feature request for the below various reasons.

and also because i don’t understand why PDFs download rather than open in another tab, i think we should have the option for that rather than thoka provide the necessary plugin.

I understand moodle have a way of displaying download page in a new tab, like the “Page is private or deos not exist” page on Discourse

I do hope this feature request gains much traction, because would be an especially large endeavour to upgrade Discourse, so the PWA is better than the Moodle App in all possible ways.