Solved

Embed HTML in HTML

Posted on 2003-12-01
10
3,489 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem with a CSS in a page 2 30
Wrapper for APPs 9 76
Increase the size of the modal in Bootstrap 5 23
Outlook opens HTML email as text 4 22
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

776 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