Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 521
  • Last Modified:

View PDf in iframe

I have an iframe within a page which is supposed to load a pdf. There is a link on the main page, which when clicked by the user will load the pdf in an iframe in the same page.

For some reason this does not happen. iframe is not able to load the pdf. The URL that is being generated is correct as when I type the PDF URL in another browser window, it gives me an option to open/save the pdf.

<iframe border="no" scrolling="yes" width="400" height="500" marginheight="0" marginwidth="0" src="http://server:8000/MyApp/application/document/'+widgets.result_list.selected_row.id

Open in new window


Is there a way to enforce this behavior?
0
ank5
Asked:
ank5
  • 4
  • 4
1 Solution
 
COBOLdinosaurCommented:
I need to see the render code for the page. Post a link to it please.

Cd&
0
 
ank5Author Commented:
It's not in public domain, so link won't work.

Will it help, if I post the HTML source?
0
 
COBOLdinosaurCommented:
It would be better if I could see rendered code.  If you display the page in your browser and view source you should be able to save that an post it.  

I am trying determine what the browser is actually seeing for the link in the scr because the quoting looks incorrect.

Cd&
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
ank5Author Commented:
Please find attached the HTML source from the browser.
Source.txt
0
 
ank5Author Commented:
I figured out that I was missing a closing double quote for the src attribute and that was causing the problem. Now the <iframe> does display, but when I click on the link it downloads the file, instead of opening it in the <iframe>. Is there a way to get around this?
0
 
COBOLdinosaurCommented:
Okay, you are probably using IE.  to support pdf in IE you will probably need to use: http://pdfobject.com/


Cd&
0
 
ank5Author Commented:
I'm using Chrome
0
 
COBOLdinosaurCommented:
AFAIK the Chrome pdf viewer is not compatible with iframe.  

You could try putting the pdf in an html page and loading the html page into the iframe.

Cd&
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now