Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not allowed to load local resource, embedded pdf in object

Tags:

html

embed

I need to open pdf in my web page, the problem is that I get the files from another server so I tried to use <object> element with url to the PDF file, but it didn't work. So instead at first I download the pdf file to my server and then I tried to use

<object alt="pdf" border="0" data="d:/WEB/ASP/soubory/Download/189005864.pdf" 
        type="application/pdf" width="100%" height="100%"></object>

But I am getting error. In chrome it says

Not allowed to load local resource

and in IE

Access denied

So I checked if the files I download are somehow restricted, but they arent and even if I rightclick on the link in my source code and select the "Open in new tab" option the browser poperly opens the pdf in new tab. So any ideas what may be wrong?

Thanks

like image 505
m3div0 Avatar asked Apr 15 '13 13:04

m3div0


1 Answers

Your web page (and more globally the browser through a web page) does not have the right to access your file system. To access a file through a web page, you need virtual path and not a physical one.

Try something like http://[Your server]/directory/yourPDF.pdf as the src of your object.

like image 102
Pouki Avatar answered Nov 13 '22 03:11

Pouki