0

I have a full HTML document that I'd like to include within an existing webpage on my website. This document is a completely standalone document with its own <html> element, its own CSS styles, etc. I do not control this document.

I basically want my webpage to show the normal header/nav of my website, a little bit of metadata about the included HTML document, and then the document itself.

So far I've tried two approaches:

  1. Inserting the document as-is into a div on the page. Problems:
    • I have to imagine this is semantically wrong in all sorts of ways
    • Styles seem to "leak out" from the inner document and affect the outer content
  2. Put the document into an iframe. Problems:
    • Links clicked within the iframe only navigate the iframe, not the outer page. I want links to behave as if they were part of the outer page.
    • I'm having a hard time styling the iframe so that it simply extends as far down the page as it needs to to contain the document. I don't want scrollbars -- I just want to dump the whole document onto my page, however large it is.

Is there some other simple solution to this problem?

isherwood
  • 58,414
  • 16
  • 114
  • 157
jobo3208
  • 792
  • 8
  • 16

1 Answers1

0

You can't achieve this with only HTML and also with client-side Javascript this is not possible. There are ways to get parts of the content of another webpage though. You might want to take a look at https://stackoverflow.com/a/11439720/3265307.

rhuijben
  • 51
  • 4