• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

14. Creating Dynamic Content > 14.3. Including External HTML Content

Including External HTML Content

NN 6, IE 5

Problem

You want to combine (include) content from another HTML document into a single document on the page.

Solution

Put the external content into an iframe element, and disguise the iframe so that it looks to be part of the regular document flow. Here is an example of an iframe element that blends seamlessly into a plain HTML page:

<iframe id="myFrame" frameborder="0" vspace="0" hspace="0" marginwidth="0" 
marginheight="0" width="100%" src="external.html" scrolling="no" 
style="overflow:visible"></iframe>

To size the iframe element correctly, you must wait for the content to load, and then use scripts to find out the content height. The following function is invoked by the onload event handler of the page, which passes the ID of the iframe to be adjusted:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint