Skip to main content

PDF IFRAME add-on for Plone

Project description

ruddocom.pdfiframer: correct handling of PDFs in IFRAMEs

This Plone add-on adds a bit of JavaScript that turns all served IFRAMEs which embed a PDF into a clickable icon the user must tap or click before the PDF is actually embedded and rendered. This behavior is only active on certain mobile browsers known not to display PDFs embedded.

This not only saves you bandwidth, it also prevents a nasty behavior on mobile devices when embedding PDFs using IFRAMEs — instead of the PDF being displayed, a download window pops up (yes, even when the server sends a Content-Disposition: inline HTTP header).

Thus, visitors to your site can see the PDF onscreen with one click, and mobile visitors can download the PDF by clicking / tapping on the icon.

Note that, by default, Plone filters IFRAME tags out of content types. Use the HTML filtering control panel configuration screen to allow IFRAMEs to be used on your Plone site.

Notes

We use a footer viewlet to include the JavaScript, because on mobile Fennec or Firefox Focus, the IFRAME has already begun loading and the download window pops up before the DOMContentLoaded event has happened.

Setup

It's a standard Plone add-on. Add to your Plone eggs list, buildout.

License

The project is licensed under the GPLv2 or later at your choice.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ruddocom.pdfiframer-1.1.tar.gz (10.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page