by KronisLV · 3y ago · 0 comments
The HTML on the page responsible for this:
<iframe class="pdf" loading="lazy" src="/pdfs/2023-01-24-how-to-lose-fp-at-work.pdf" title="How to Lose Functional Programming at Work - PDF">
</iframe>
Here's approximately what I've used myself in the past as an alternative: <object data="/files/my-document.pdf#zoom=110" type="application/pdf" class="my-style-class" title="My PDF document">
<!-- Fallback for older browsers that do not support the object tag -->
<embed src="/files/my-document.pdf#zoom=110" type="application/pdf">
<!-- Fallback in case PDF display of any sort is not supported -->
<noembed>
<span class="my-warning-class">
It seems like your browser does not support displaying PDF files.
You can download the file separately <a href="/files/my-document.pdf" download>here</a>.
</span>
</noembed>
</embed>
</object>
(not too clean of a solution, but seems to work okay in most cases)The presentation/article itself is pretty nice, though. I really like the mentions of the human aspect of it all, how getting others onboard is quite important!
I'll take a look at using an embed tonight. Thanks for the feedback!
I looked into it and it indeed is the settings!
To reproduce the behavior, you'd go to General > Applications, then find PDF and if it's set to "Open in Firefox" then it will render inline, whereas if it's set to any of the other options, then it won't:
- Open in Firefox: will show the PDF inline, which is probably your setting
- Always ask: opening the webpage will result in a prompt for what to do with the PDF
- Save file: will always download it
- Use OS default application: will download it and then open it
This doesn't seem to be the case with the alternative approach, which just renders it inline always (when the browser in question supports the functionality), though this is definitely a bit of interesting behavior otherwise!so a text-link outstide of noembed would be a nice alternative anyways, i bet it will be better for screenreaders too