How to Load a PDF in a Lightbox on Mobile Safari

Justin | design,HTML5,tips | Monday, July 3rd, 2017

PDF inside lightbox on an ipad

A lightbox—which opens on top of the site (or app) that you are currently viewing—is a great way to load external content, but remain on the same page once the content is closed.

As a designer, a lightbox is a useful tool to keep readers in your “experience” and not force them to find their way back to your page.

Technically speaking, a lightbox loads external content into an <iframe>.

in5 (InDesign to HTML5) let’s you add lightboxes with a single checkbox—no coding or hassle required (and no thinking about iframes)!

The Problem: iOS, Lightboxes, and Multipage PDFs

A handful of in5 customers found that when loading multipage PDFs into a lightbox on iOS devices (iPads and iPhones), you can’t navigate to the second page.

This happens in part because iOS has a PDF viewer built into the web browser.

Normally, the built-in PDF view is quite handy, but when it’s loaded into an iframe, you don’t have access to the page navigation.

Google Drive to the Rescue!

Fortunately, if you

  1. upload your PDF to Google Drive and
  2. grab a shareable link; the

Google online PDF viewer will let you navigate through all the pages (even in a lightbox).

Simply replace the hyperlink to your PDF with the Google Drive shareable URL.

Other sharing services that can view PDFs online would probably work too (e.g., Dropbox), but you may want to factor in how much user interface (UI) and branding of the service itself adds around the document.

Google Drive will keep the UI minimal if you add &embedded=true to the end of the URL.

Original Source: http://stackoverflow.com/questions/15480804/problems-displaying-pdf-in-iframe-on-mobile-safari

Eureka! More Web Problems Solved

These FREE email lessons will deliver solutions to your inbox over 3 weeks and share techniques with you to solve the toughest of web problems.

We respect your privacy. Powered by ConvertKit

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *