3

I have a page that contains PDF File in it. Luckily, it works in IE. But when I run it in chrome, it gives me this error : enter image description here

I googled it and it seems like chrome isn't already allowing us to view PDF's now. Here is the code for embedding PFD :

<div id="pdf" style="width: 100%; height: 100%;">
    <iframe src="C:\Users\jmanaban\Downloads\Programming Handbook.pdf" style="width: 100%; height: 100%;" frameborder="0" scrolling="no">
        <p>It appears your web browser doesn't support iframes.</p>
    </iframe>
</div>

So the question is, is there still a way or alternatives to embed PDF files in chrome without using any extensions or plugins just like IE? How am I gonna do it? Thanks in advance.

I still didn't this one appear

<p>It appears your web browser doesn't support iframes.</p>

so I think there's still hope.

JanLeeYu
  • 981
  • 2
  • 9
  • 24
  • See this issue: http://stackoverflow.com/questions/32509068/error-not-allowed-to-load-local-resource-file-sharedpath – Chattervast Mar 17 '16 at 12:12

1 Answers1

1

Write the src as relative path. Put both Programming Handbook.pdf and the HTML file in same folder and change src to:

src="Programming Handbook.pdf"
Naman Nehra
  • 630
  • 4
  • 10
  • yes. gladly it worked. do you know the reason why it didn't show up when I im not using a relative path? – JanLeeYu Mar 18 '16 at 07:29
  • Using local path to files on your computer is not allowed as it'll allow web pages to access any file on your computer – Naman Nehra Mar 18 '16 at 07:35
  • You can read more about it here https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS – Naman Nehra Mar 18 '16 at 07:50