Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Embed HTML in HTML

Posted on 2003-12-01
10
Medium Priority
?
3,501 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 140 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

926 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