473,385 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How can I "include" an HTML file from *another* server?


Hi,

got the following problem: I need to include an HTML file that sits on
another server B in an HTML file that sits on server A, and I need to
include this at a particular place in the file. The "include" command
doesnt work obviously as it is server-side.

In other words: say I have a webpage, at a particular place, for
example halfway down, I want to include HTML that sits on another
server.

Can anyone point to a javascript code that can do this?

Thanks!

Michael

Mar 18 '06 #1
3 1640
wrote on 18 mrt 2006 in comp.lang.javascript:
got the following problem: I need to include an HTML file that sits on
another server B in an HTML file that sits on server A, and I need to
include this at a particular place in the file. The "include" command
doesnt work obviously as it is server-side.
That would only be obvious if you preclude that serverside coding.
In other words: say I have a webpage, at a particular place, for
example halfway down, I want to include HTML that sits on another
server.

Can anyone point to a javascript code that can do this?


Use in IE:

function getUrl(url) {
var http = new ActiveXObject("microsoft.xmlhttp");
http.open("GET",url,false);
http.send();
return http.responseText;
}

Look here:

<http://xkr.us/code/javascript/XHConn/>

for a more cross browser solution.

Many security settings will give you a nightmare, so:

The best solution is swapping your server to an ASP (or PHP) one!

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 18 '06 #2


in******@hotmail.de wrote:
In other words: say I have a webpage, at a particular place, for
example halfway down, I want to include HTML that sits on another
server.


There is the HTML iframe element and the object element, both allow you
to insert a document from a different server e.g.
<iframe src="http://example.org/whatever.html"></iframe>
or e.g.
<object type="text/html"
data="http://example.org/whatever.html"></object>

Client-side script does not help at all.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Mar 18 '06 #3

thanks all, iframe seems to do the job!

Mar 21 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

43
by: steve | last post by:
I am quite frustrated with php’s include, as I have spent a ton of time on it already... anyone can tell me why it was designed like this (or something I don’t get)? The path in include is...
2
by: steve | last post by:
Hi, I need to do conditional script "include", but like to pull the code from db instead of a file. How do I do that? Reason: I like to implement some complex regex logic, and make it table...
2
by: N. Graves | last post by:
Hey, I need to have a template ASP page that can dynamically include another file depending on that I call in the address. I have yet to make this work. Here is a sample of what I thought...
4
by: Simon Wigzell | last post by:
I often use : <!--#include file="filename"--> in my code to include often used bits of asp code. I told someone in another newsgroup about it but now I'm wondering if it will be supported for...
4
by: michaaal | last post by:
I have two folders in my website... Folder1 (this is where my #include file is, this is where the style.css is) --Folder2 (Folder2 is inside of Folder1) Folder2 contains a file that has...
3
by: Buddy Robbins | last post by:
Hey folks, I am re-writing an ASP.Net site for a company. The client wants to be responsible for the static content and navigation of their site, and I'll be responsible for any dynamic content. ...
6
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing...
2
by: Susan Baker | last post by:
Hi, I am (trying) to compile some code I downloaded from the internet. The sources contain references to header files - using the form : #include <pathname/file> If I change the form to...
10
by: Eric | last post by:
Hello, I have some server side includes on a Classic asp page that look something like: <!-- #include virtual="/includes/file1.asp"--> <!-- #include virtual="/includes/file2.asp" --> <!--...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.