You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
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.
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:
pdfViewerEnabled
false
true
false
true
***true
Notes
false
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 befalse
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
api.Navigator.pdfViewerEnabled
The text was updated successfully, but these errors were encountered: