Main Topics
Browse All TopicsIs it possible to call a HTML file whithin another page?
I want to implement a page that devide in two section and each one refer to a sperate html file.
(somthing like frames or shared boreders but I dont want use them.I want some codes.)
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
server side includes are among the best options..
http://bignosebird.com/ssi
<script type=html src=imcludefile.html></scr
http://www.allmyfaqs.com/f
i think u can use iframes that won't appear like frames if u r afraid of them :)
use the code:
<iframe src="http://www.msn.com" scrolling="auto"></iframe>
hope this helps,
kanary
Does your web server support some server side scripting language such as PHP or Perl? Does it support SSIs (Server Side Includes)? If not, you have two main routes, IFRAME and Javacript. I think IFRAME has already been explained in enough detail above, but JavaScript isn't.
If you wish to include very little content, you can use the following trick:
<script type="text/javascript" language="JavaScript" src="littlecontent.js"></s
Where littlecontent.js contains lines like:
document.write('<p>A paragraph of text</p>');
document.write('<img src="someimage.gif">');
Now the other option is to use XMLHttpRequest. It currently only works in later Mozillas, Netscape 7 and IE6.0. You should be able to find some example code with Google. Due to browser compatibility, server side scripting is my first recommendation and IFRAME is the second. Don't use JavaScript if you don't have to.
here is a simple php one I have used:
<?php
/*
INSTRUCTIONS:
If you want to frame a page outside of your site do the following.
http://www.yoursite.com/fr
If you want to frame a page within your site, in a different directory.
http://www.yoursite.com/fr
If you want to frame a page within your site in the same directory.
http://www.yoursite.com/fr
*/
/*************************
/* Configurable Settings */
/*************************
$title = "";
$top_h = "70";
$main_h = "*";
$topsrc = "";
$topsrc_name = "top";
$mainsrc_name = "main";
$topborder = "0";
$mainborder = "0";
$frameborder = "0";
/*************************
/* End Config Settings */
/*************************
echo "
<html>
<head>
<title>$title</title>
</head>
<frameset rows=\"$top_h, $main_h\" frameborder=\"$frameborder
<frame src=\"$topsrc\" scrolling=\"no\" noresize=\"noresize\" name=\"$topsrc_name\" border=\"$topborder\">
<frame src=\"$mainsrc\" scrolling=\"yes\" noresize=\"noresize\" name=\"$mainsrc_name\" border=\"$mainborder\">
</frameset>
</html>
";
?>
This one was oruginally written by ZUg Scripts.
~Aleksey
ah! you don't want frames. iframes would be the best option. the above script can be modified to to that semi-dynamically:
<?php
/*************************
/* Configurable Settings */
/*************************
$title = "";
$iframe_h = "200";
$iframe_w = "200";
$iframe_src = "somefile.htm";
$iframe_name = "name";
$iframe_border = "2";
/*************************
/* End Config Settings */
/*************************
echo "
<html>
<head>
<title>$title</title>
</head>
<h1>Page with iframe</h1>
<p>This is a page that has an iframe in it</p>
<iframe height=\"$iframe_h\" width=\"$iframe_w\" src=\"$iframe_src\" frameborder=\"$iframe_bord
</iframe>
</html>
";
?>
The links of the ifram contents is hardcoded though.
~Aleksey
Guys, he may not have a PHP host... here is what I would try man, most hosts have SSI, Server Side includes available. Since you don't want to use framse, and I don't blame you, simply do this...
<!-- #INCLUDE FILE="FILENAME" -->
You can do this anywhere inside your HTML source. If your host has SSI enabled, which most do, this would probably be the most optimal way for you to do what you are trying. ;) Good luck.
<HTML>
<HEAD>
<SCRIPT language='JavaScript'>
function include(url) // must be a fully qualified URL, I don't know why
{
if ( document.all )
{
var xml = new ActiveXObject("Microsoft.X
xml.Open( "GET", url, false );
xml.Send()
document.writeln(xml.respo
}
else // Netscape code by itzsuresh taken from http://www.experts-exchang
{
if ((location.host=='' && url.indexOf(location.proto
{
netscape.security.Privileg
}
var dest = new java.net.URL(url);
var dis = new java.io.DataInputStream(de
var res = "";
while ((line = dis.readLine()) != null)
{
res += line + java.lang.System.getProper
}
dis.close();
document.writeln(res);
}
}
</script>
</head>
<BODY>
Included file:<BR>
<div id="test">
<SCRIPT language='JavaScript'>
include("http://www.foxnew
</script>
</div>
</body>
</html>
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:
Split: dorward {http:#8915857} & brunobear {http:#8916418} & gastello {http:#8963121} & homewabbit {http:#9024940}
Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
mplungjan
EE Cleanup Volunteer
Business Accounts
Answer for Membership
by: mplungjanPosted on 2003-07-14 at 02:15:08ID: 8915538
Sounds like EXACTLY what frames or iframes are for.
Unless you use xmlhttp or a server process you would need to use frames
Michel