Is it really not possible to display a remote PDF in an iframe?
I have a mind-numbingly dull task that I'm trying to speed up by writing some PHP scripts that run on my localhost, fetch remote web pages, and distill certain info. Part of the process that I'm trying to expedite is to show some data extracted from an article abstract along with a PDF of the article. My script fetches the html from the abstract, looks for the values I'm after and shows them to me and I'd like to go ahead and show the PDF in a frame or iframe. It may sound trivial to click one more <a> link to open the PDF, but if I could save that one click, it will result in a great deal of time saved over the life of this project.
Is there no way to display both my distilled information and the pdf in a single window?
Originally Posted by firefox
You should be using
Possibly specifying width and height too since those will default to small values.
<object type="application/pdf" data="url"></object>
Thanks for your suggestion, but I tried this:
and it doesn't even result in a request to the remote site or a "blocked content" message.
<object type="application/pdf" data="http://example.com/pdf?res=blahblahblah" style="width:100%; height:800px;"></object>
Do you have this live somewhere we could view? Also, which browser are you using?
You might have to include an <embed> tag inside the <object> for maximum browser compatibility. However, using Chrome, the <object>-only approach above appears to work just fine for me.
Did you also inspect the actual requests involved from your browser? Object works in both Chrome and FF. It does of course still require the browser to have capabilities for displaying pdfs. Else you'd need fallback content or nothing will show.
I'm using firefox on an Ubuntu workstation. I did inspect (using firebug) the requests sent and there appears to be only the request for the page itself -- the <object> tag doesn't result in any request at all. I've had no problem displaying these PDFs when accessing them directly in firefox.
After some tinkering, I have isolated the problem. The page in which I want to show this pdf is hosted via HTTPS and the pdf link is not. It works fine when page is not hosted via HTTPS. In retrospect, this is not surprising that the browser would be annoying about HTTPS hosted pages. Kind of a relief actually.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)