0

I have a list of items on a webpage and if I click on one, it will open a pdf associated with that item....Simple enough! However, I want that pdf to open in a DIV which will be elsewhere on the page and of course any of the other links clicked on, to open in the same DIV. I feel this should be simple in HTML but need a pointer in the right direction. I don't have access to PHP.

Many thanks in advance,

1 Answers1

0

If "any of the other links clicked on" refers to links in the PDF, you won't be able to get consistent behavior. While the <iframe> will display the PDF, the behavior of the links in the PDF will be different depending on the browser and PDF viewer on the client. For example, the cross document links won't work at all in Chrome and Edge but will in IE (gross) with Adobe Reader installed.

If "any of the other links clicked on" refers to links in the rest of the HTML, then just use JavaScript to update the "src" property of the iframe. The PDF should change automatically.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
joelgeraci
  • 4,606
  • 1
  • 12
  • 19