Solved

Embed HTML in HTML

Posted on 2003-12-01
10
3,488 Views
Last Modified: 2009-11-08
I would like to include a HTML (full page and without scrollbar) into another HTML. I had tried to use #include but its not work at all, and I also tried to use <iframe> but it is needed to specify the height of the frame, it is not good for my page (double scrollbar, one for frame and one for window). The HTML whick needed to embeded with several pages with different height. Therefore, I would like to embed the html page with dynamic height which depends on the height of the embeded page size.

Are there any methods ?

Thanks a Lot and I am hurry.

Regards,
sL
0
Comment
Question by:sLso
10 Comments
 
LVL 2

Expert Comment

by:HeadAcheMike
ID: 9857593
you could tdo it the php way (presuming php is installed on your server):

<?php
include('file.html');
?>

the contents of the file file.html will be written into the main file thats calling it
note: the extension of the page will have to be changed to .php
0
 
LVL 17

Accepted Solution

by:
dorward earned 35 total points
ID: 9857671
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 9857961
try this, uses javascript to resize an iframe, just change the iframe width to what you need

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
      <title>Untitled</title>
      <script>
      function resizeToContent(){
      var x =document.getElementById("dynamIframe").scrollHeight;
      var z = x-200;
      var y =screen.availHeight;
      while (x < y){
            x+=1;
      }
      x-=z;
      document.getElementById("dynamIframe").style.height=x
}
      
      </script>
</head>
 
<body onload="resizeToContent()">


<iframe id="dynamIframe" src="users.cfm" width="180" height="75" hspace="0" vspace="0" frameborder="0"><frame src="users.cfm" width="180" height="75" hspace="0" vspace="0" scroling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
</body>
</html>
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 7

Expert Comment

by:gam3r_3xtr3m3
ID: 9858112
PHP:
<?php include('file.html'); ?>
ASP/SHTML:
<!-- #include file="file.html" //-->

>> ...I would like to embed the html page with dynamic height which depends on the height of the embeded page size.
what should be the size of the embedded page size? the whole page? as in the whole? you could do it dynamically somewhat like this...:

<body topmargin="0" leftmargin="0">
<iframe marginwidth="0" marginheight="0" borderwidth="0" framespacing="0" frameborder="no" scrolling="no" onLoad="this.style.height=screen.availHeight; this.style.width=screen.availWidth;" src="embed.html">
How can i embed if you don't have iframes???
</iframe>
</body>
0
 
LVL 1

Author Comment

by:sLso
ID: 9863318
gam3r_3xtr3m3,

The height is the whole page of the embedded website. For example, if I using iframe, the frame no scrollbar is needed. The iframe's height is equal to the embedded page's height. Only the window's scrollbar is needed.

But the embedded website's pages with different height. So, I would like the height of the frame with dynamic height if I using frame.

Many Thanks,
sL
0
 

Expert Comment

by:Nelson_Pires
ID: 9866416
The include method works, but you need to rename the calling page to .SHTML or .SHTM, since the includes are SSI (Server Side Includes) so the server must be able to process them, also note the include can be file or virtual, observe:

<!--#include file="file.html" -->
<!--#include virtual="file.html" -->

Hope it helps.
0
 
LVL 3

Expert Comment

by:IGneon10
ID: 9870730
all you need is to embed this into the exsisting HTML file:
<iframe src="embeddedpage.html"></iframe>

For an example an attributes you can use, go to the site W3Schools has on it:
http://www.w3schools.com/tags/tag_iframe.asp
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now