1

So,i have an iframe tag inside a bootstrap modal window that has as its src a PDF file located in the public folder of my rails app. The problem is that everytime i deploy the app to Heroku, and access it using a mobile device (tablet and smartphone), the browser simply download this PDF file automatically.

This is the modal window with the iframe in it:

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button></br>
        <h4 class="modal-title" id="myModalLabel"><span class="glyphicon glyphicon-calendar"></span> Agenda de Aulas - 12/2015</h4>
      </div>
      <div class="modal-body">
        <iframe id="modalframe" src="calendar.pdf"></iframe>
      </div>
    </div>
  </div>
</div>

At the same time, the pdf doesnt show up in the modal when its accessed using a mobile device. It only shows up on bigger screens. Maybe it has something to do with the file being downloaded, i dont know.

I've been searching a lot, but couldnt find an answer so far. What can i do to solve this? Thanks!

Caio Graco
  • 37
  • 5
  • Have a read of this http://stackoverflow.com/questions/6137457/how-to-embed-pdfs-that-work-in-all-web-and-mobile-browsers - that pdfobject link looks good. Basically pdf displaying "just works" in pc/mac browsers and tends to "just not work" on mobile, without a bit of extra help. – Max Williams Nov 24 '15 at 10:54
  • So a solution would be turning the pdf into a img file? It's just an one page pdf, so... – Caio Graco Nov 24 '15 at 10:59
  • No, i don't think that would be necessary. – Max Williams Nov 24 '15 at 11:13
  • You'd want it to actually *be* a pdf file so that people can save it to their phone. It's just the dynamic displaying of pdfs on smartphones that is a little bit tricksy: they don't naturally do it well. Showing it in an iframe is likely to cause extra problems but they are not insurmountable i think. – Max Williams Nov 24 '15 at 11:14

0 Answers0