Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
69
rated 0 times [  71] [ 2]  / answers: 1 / hits: 25835  / 9 Years ago, wed, april 29, 2015, 12:00:00

I'm using PDF.Js to embed PDF file for preview, and I removed the script of download and open files from the viewer.js , but when I test the page and PDF file try to show, the Internet Download Manager download it and abort the preview .. after search I found that using object instead of iframe may solve the problem, but it didn't work the pdf viewer appeared white, what can I do to prevent auto download ? or using another way (Plugin) to show PDF file content.



<iframe 
class=pdf
webkitallowfullscreen=
mozallowfullscreen=
allowfullscreen=
frameborder=no
width='.$width.'
height='.$height.'
src='.$baseurl.'/assets/pdf/web/viewer.html?file='.urlencode($pdf_url).'
data-src='.$pdf_url.'>
'.$pdf_url.'
</iframe>


enter


More From » pdf

 Answers
11

This is not something related to developing issue , this is something related to user specific environement.



The Issue :



Using IDM ,any URL that ends with a media extension (e.g *.JPG , *.PNG , *.MP4 , *.WMV , *.PDF ..etc ) will be downloaded automatically , However on the other hand if the user doesnt have IDM installed , the file will be viewed immediately in browser window.



Possible Solutions :




  1. Remove PDF extension Handler from IDM , to prevent auto download, and i think the image explains it very well.



IDM




  1. Modify response header for your PDF link to force your browser to view pdf inside its view , please consider that each browser may handle the response differently , more details about this method can be found here.



Final Note:




As a developer you shouldnt handle each user specific environment , we
suppose that when user installs a specific app to handle generic files
, then it is his/her role to handle that application , and not the
developer role , cause if you follow this algorithm you jump inside
infinite loop handling different users specific setup.



[#66818] Tuesday, April 28, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brittanye

Total Points: 263
Total Questions: 94
Total Answers: 115

Location: Burkina Faso
Member since Thu, Dec 23, 2021
3 Years ago
brittanye questions
Mon, Aug 10, 20, 00:00, 4 Years ago
Tue, Jun 16, 20, 00:00, 4 Years ago
Wed, Apr 22, 20, 00:00, 4 Years ago
Mon, Apr 13, 20, 00:00, 4 Years ago
;