Embedding PDF Files in chrome
11,986
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"
Comments
-
JanLeeYu almost 2 years
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 :
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 about 8 yearsyes. gladly it worked. do you know the reason why it didn't show up when I im not using a relative path?
-
Naman Nehra about 8 yearsUsing 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 about 8 yearsYou can read more about it here developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS