Embedding Two Html Documents Into One Page
Solution 1:
You mean like this:
<html><head></head><framesetcols="30%,*"><framesrc="page01.html"><framesrc="page02.html"></frameset></html>Solution 2:
Not possible. Neither iframe nor frame is inline. The best for your scenario would be to extract the body tag content, and insert it into a div. CSS would be a problem, though - there'd have to be some processing on it so it would be restricted to just half the page. Something like this:
<html><head><title>Combined</title></head><body><divid="page1">
First page here
</div><divid="page2">
Second page here
</div></body></html>CSS transformation: body -> #page1 (or #page2), #id -> #id, anything else X -> #page1 X.
Using iframes is definitely easier; and if the server is well-configured, it probably doesn't even require a separate connection.
BTW: Your suggestion will probably render, but AFAIK it's non-standard (browsers guessing what you want, instead going by the specification, something browsers have gotten used to having to do); and there's still the problem of CSS.
Solution 3:
Unless there is one HTML file - as specified in your question - where the contents of both HTML pages are in one file, you will have to hit the server more than once.
Also the HTTP protocol transfers one object at a time. Unless one of the objects is cached, you will also have to talk to the server twice.
Solution 4:
you could use server side includes but no matter you will be making two server requests if there are two different files.
Solution 5:
It might be overkill, and you don't really talk about where the component pages come from, but you might check out SiteMesh. It's a server-side framework designed to take output pages from other frameworks/apps running on a site, then...
The HTML content is intercepted on its way back to the web-browser where it is parsed. The contents of the
<head>tag and the<body>tag are extracted as well as meta-data properties of the page (such as title,<meta>tags and attributes of the<html>and<body>tags).
then outputs a single page. IIRC, LinkedIn uses it to apply a consistent header and other page elements around pages generated by different systems.
Post a Comment for "Embedding Two Html Documents Into One Page"