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 details)

Uploaded Source

File details

Details for the file ruddocom.pdfiframer-1.1.tar.gz.

File metadata

  • Download URL: ruddocom.pdfiframer-1.1.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.9.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.9

File hashes

Hashes for ruddocom.pdfiframer-1.1.tar.gz
Algorithm Hash digest
SHA256 59f47f6d3b6a94ab3345516a225969c6b4b45dd465e74dfb8a2f49ff9f6cd278
MD5 9fb294a0fda4e7385f281d9257eb30d3
BLAKE2b-256 f0ac56540042788430dc757ffe1bf2e5ec0888d13bb283aeef43640f9cf981e7

See more details on using hashes here.

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