In the Discourse Plugin category, user thoka introduced a plugin designed to serve local PDF uploads inline, allowing them to display directly in the browser rather than forcing a download. The plugin was created after a feature request to Discourse core received no response.
The discussion explored several technical aspects and comparisons:
Functionality vs. Themes: nathank asked how this differed from existing Theme Components, to which Canapin clarified that the plugin opens the PDF directly in the browser window, not embedded within a post element.
Compatibility: Jagster inquired about S3 and CDN support. thoka confirmed the plugin does not alter how S3 serves PDFs.
Stability: meglio questioned the plugin’s current status. thoka initially reported it was broken but later confirmed in post 12 that it is working as expected.
Mobile UX Concerns: thoka noted potential downsides, such as users exiting the Discourse Progressive Web App interface to view the PDF and reliance on specific browser behaviors (e.g., Chrome on Android often forces downloads).
Core Integration: ajschmidt suggested upstreaming the feature, but thoka reiterated that the plugin was necessary due to the lack of response to the original request.
The thread concluded with Canapin noting that the plugin is no longer needed, as Discourse has updated its core behavior to open PDFs directly by default.
I wrote the plugin, since there were no responses to my feature request.
When thinking about drawbacks of sending PDFs to the browser directly, I envision the following potential issues:
When utilizing Discourse as a Progressive Web App on a mobile device, one inevitably exits the Discourse interface, or rather its user interface, to display the PDF, thereby relying on the user’s familiarity with navigating back to the original application.
Furthermore, when it comes to mobile devices, one is at the mercy of how the browser handles inline PDFs. While Firefox currently displays the file directly, it appears that there is no way to persuade Chrome to do so: