Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fancybox PDF issue in Firefox

I have Fancybox set up so that when a user clicks on a pdf link it displays the pdf in a pop up, however in Firefox it asks if you want to save or open the file and I don't want this. How can I force the pdf to be display in the fancybox popup? It works in Safari.

<a class="pdf" href="http://www.test.co.u.uk/test.pdf">test.pdf</a>

$(".pdf").fancybox({
   'width' : '700',
   'height' : '700',
   'autoScale' : true,
   'transitionIn' : 'none',
   'transitionOut' : 'none',
   'type' : 'iframe'
});
like image 482
green_arrow Avatar asked Nov 05 '22 08:11

green_arrow


1 Answers

Personally, I would just use Google Docs to display the PDF in an iframe. It automatically resizes the PDF to match the iframe dimensions. Here is the format to use:

<iframe src="http://docs.google.com/gview?url=http://samplepdf.com/sample.pdf&embedded=true" style="width:100%; height:100%;" frameborder="0"></iframe>

You don't need flash or any other plugins.

like image 158
Mottie Avatar answered Nov 13 '22 20:11

Mottie