pipwerks / PDFObject

A lightweight JavaScript utility for dynamically embedding PDFs in HTML documents.
http://pdfobject.com/
Other
2.39k stars 986 forks source link

I am getting "This browser does not support inline PDFs." on Chrome #305

Closed Jejugo closed 1 month ago

Jejugo commented 1 month ago

Not sure exactly why but whenever trying to render a PDF we're getting this error "This browser does not support inline PDFs." on Chrome. It was working before and It's working for other browsers though. Any thoughts?

BTW I'm on Mac

theodore-s-beers commented 1 month ago

What do you see if you load this page?

https://pdf-support.pages.dev/

Jejugo commented 1 month ago

What do you see if you load this page?

https://pdf-support.pages.dev/

@theodore-s-beers image

is this navigator.pdfViewerEnabled: false something we need to manually enable on chrome?

theodore-s-beers commented 1 month ago

You shouldn't need to manually enable it; more likely it was manually disabled at some point, and that's why you're seeing the embed failure. In Chrome on macOS, enter Settings, Privacy and security, Site settings, Additional content settings, PDF documents, Open PDFs in Chrome. At least, I think that's what sets this flag.

pipwerks commented 1 month ago

Thanks @theodore-s-beers

@Jejugo I've seen this happen with others as well. Browsers (esp on a fresh install) typically ask if you want to display the PDF in the browser or download it, then will save that preference. It's very possible at some point you were prompted to choose, and didn't realize it would affect future PDF interactions.

FWIW the logic of navigator.pdfViewerEnabled is spelled out here: https://pdfobject.com/api/#pdfobject-supportspdfs

I'm on a Mac and just verified it works fine in Chrome.