Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api.Navigator.pdfViewerEnabled - unexpected firefox behaviour #22952

Open
uuf6429 opened this issue Apr 26, 2024 · 0 comments
Open

api.Navigator.pdfViewerEnabled - unexpected firefox behaviour #22952

uuf6429 opened this issue Apr 26, 2024 · 0 comments
Labels
data:api 🐇 Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API

Comments

@uuf6429
Copy link

uuf6429 commented Apr 26, 2024

What type of issue is this?

Incorrect support data: Navigator.pdfViewerEnabled is reported as fully supported by all browsers, but Firefox (at least) only partially supports it (see also bug link below).

What information was incorrect, unhelpful, or incomplete?

The behaviour is not consistent across browsers:

Browser / Env Built-in PDF Viewer? Opening PDF Behaviour pdfViewerEnabled
Chrome HarmonyOS (tablet) no n/a false
Chrome OSX yes pdf is embedded* true
Chrome OSX yes pdf is downloaded false
Firefox Win10 yes pdf is downloaded** true ***
Firefox Win10 yes pdf is embedded true

Notes

  • * Chrome (and most other browsers) embed pdfs by default
  • ** Firefox downloads pdfs by default
  • (Of course we're not talking about other cases where downloads would be triggered, such as content disposition or returning the wrong content media type)
  • *** Expected to be false
  • For web developers, we care if the pdf will actually be embedded, not just in theory
  • I needed this for printing purposes: if the browser reports that pdfs will be embedded, I would use a standard iframe + window.print(), otherwise I fallback to pdf.js rendering. In case of firefox, there's no way to properly detect that, so I'll be forced to do browser sniffing for firefox - which, on the other hand, harms the case where pdfs would have actually been embedded.

What browsers does this problem apply to, if applicable?

Firefox

What did you expect to see?

pdfViewerEnabled is expected to be false when the browser will not embed a PDF.

Did you test this? If so, how?

Yes, on BrowserStack and my local machine: opening the browser dev tools and checking the result of navigator.pdfViewerEnabled.

Can you link to any release notes, bugs, pull requests, or MDN pages related to this?

Do you have anything more you want to share?

I doubt this will be fixed/changed ("backward compatibility" and all that), so it makes sense to have a big fat warning in the documentation, because it would definitely spare some people a lot of headaches and bug reports.

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/Navigator/pdfViewerEnabled

MDN metadata

MDN page report details
  • Query: api.Navigator.pdfViewerEnabled
  • Report started: 2024-04-26T13:40:41.560Z
@queengooborg queengooborg added the data:api 🐇 Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API label Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:api 🐇 Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API
Projects
None yet
Development

No branches or pull requests

2 participants