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"
Share:
11,986
JanLeeYu
Author by

JanLeeYu

ReactJS / React Native Dev

Updated on June 26, 2022

Comments

  • JanLeeYu
    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 : 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
    JanLeeYu about 8 years
    yes. gladly it worked. do you know the reason why it didn't show up when I im not using a relative path?
  • Naman Nehra
    Naman Nehra about 8 years
    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
    Naman Nehra about 8 years