Skip to content

fix: replace <object> PDF preview with open/download buttons for mobile#5907

Open
chphch wants to merge 2 commits intofilebrowser:masterfrom
chphch:fix/pdf-mobile-preview
Open

fix: replace <object> PDF preview with open/download buttons for mobile#5907
chphch wants to merge 2 commits intofilebrowser:masterfrom
chphch:fix/pdf-mobile-preview

Conversation

@chphch
Copy link
Copy Markdown

@chphch chphch commented Apr 16, 2026

Summary

  • Replaces <object v-else-if="isPdf"> with open/download buttons
  • Fixes PDF preview on iOS Safari (black screen) and Android Chrome (no render)
  • Uses existing directUrl and downloadUrl computed properties — no new code
  • Single file change (frontend/src/views/files/Preview.vue)

Fixes #5906

Related: #3317 (iOS black screen), #3583 (Android PDF plugin)

Before / After

Before: <object> tag — renders on desktop Chrome/Firefox, fails silently on mobile

After: Open in new tab + Download buttons — works on all platforms, consistent with the existing blob/unsupported file UI pattern

Test plan

  • Open a PDF on desktop browser — buttons appear, "Open file" launches native PDF viewer
  • Open a PDF on iOS Safari — buttons appear, no black screen
  • Open a PDF on Android Chrome — buttons appear, PDF opens correctly
  • Download button works on all platforms

🤖 Generated with Claude Code
via Happy

hacdias and others added 2 commits April 11, 2026 07:56
…le compatibility

The <object> tag fails silently on iOS Safari (black screen) and Android
Chrome (PDF plugin unavailable). Replace with open/download buttons that
launch the native browser PDF viewer in a new tab, using the existing
directUrl and downloadUrl computed properties.

Fixes filebrowser#5906

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
@chphch chphch requested a review from a team as a code owner April 16, 2026 00:39
@ramiresviana
Copy link
Copy Markdown
Member

Removing the desktop ability to display the pdf directly because mobile has no support for it doesn't seem the correct approach. Browsers provides the navigator.pdfViewerEnabled API which can be used to whether display the file or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

fix: PDF preview broken on mobile (iOS Safari black screen, Android no render)

3 participants