wp-shortcake / shortcake-bakery

A fine selection of shortcodes for WordPress
42 stars 16 forks source link

Include PDF.js rather than hotlinking from mozilla.github.io #192

Open rmccue opened 7 years ago

rmccue commented 7 years ago

Right now, the PDF shortcode outputs an iframe which loads https://mozilla.github.io/pdf.js/web/viewer.html

Since this is on a different origin, it requires local PDFs (in uploads, e.g.) to have cross-origin headers. If this was bundled with Shortcake Bakery instead, CORS headers would not be required for local PDFs.

(As a sidenote, maybe having UI to select a local PDF rather than just a URL would be cool too.)

danielbachhuber commented 7 years ago

I tried this at the very beginning, and ran into some issue where I realized it was easier to just hotlink.

This was the original post for the shortcode, btw http://fusion.net/story/31465/here-are-the-best-parts-of-the-leaked-budget-for-the-interview-north-koreas-least-favorite-movie/

danielbachhuber commented 7 years ago

Looks like someone broke the S3 bucket :)

image

rmccue commented 7 years ago

Potentially building in a CORS proxy might work as well, although could have copyright repercussions since you're essentially rehosting the content, plus performance would suckkkkk.

goldenapples commented 7 years ago

197 makes it possible to embed locally-hosted pdfs.

To do in followup: