By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,568 Members | 1,194 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,568 IT Pros & Developers. It's quick & easy.

embedding other pages (same domain) in a new page?

P: n/a
Hi,
Newbie here so bear with me please.
I'm wondering if it's possible to use Javascript to write a new page
that contains other pages in the same domain without using frame or
layer.

Say I have "http://mydomain.com/page1.htm" and
"http://mydomain.com/page2.htm"
already. Is it possible to put a Javascript on
"http://mydomain.com/page3.htm"
and it reads page1 and page2 and then writes out a new page like this -
PAGE1 STARTS HERE
<<<<<<<<<<<<<<<<<<<< page1.htm content goes here
PAGE2 STARTS HERE
<<<<<<<<<<<<<<<<<<<< page2.htm content goes here

If so, is it possible to parse/edit page1.htm and page2.htm before
writing
them out.

Thank you in advance.
Barry
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
In article <3F***************@mail.com>, Paul Chao <ba*****@mail.com> writes:
Hi,
Newbie here so bear with me please.
I'm wondering if it's possible to use Javascript to write a new page
that contains other pages in the same domain without using frame or
layer.
Yes [1].
Say I have "http://mydomain.com/page1.htm" and
"http://mydomain.com/page2.htm"
already. Is it possible to put a Javascript on
"http://mydomain.com/page3.htm"
and it reads page1 and page2 and then writes out a new page like this -
PAGE1 STARTS HERE
<<<<<<<<<<<<<<<<<<<< page1.htm content goes here
PAGE2 STARTS HERE
<<<<<<<<<<<<<<<<<<<< page2.htm content goes here
Yes [1].

If so, is it possible to parse/edit page1.htm and page2.htm before
writing
them out.


Yes[1].

[1] In browsers that support HTTPRequest objects. MSIE and Mozilla based are
the only two I have tested it in.

--
Randy
Jul 20 '05 #2

P: n/a
Paul Chao wrote:
I'm wondering if it's possible to use Javascript to write a new page
that contains other pages in the same domain without using frame or
layer.
Yes, it is. Are we talking about client-side or server-side JavaScript?

If client-side:

You depend on the Document Object Model (DOM) of the HTML user agent
to retrieve the content of other files and you depend on client-side
script support. Better do it server-side.

If server-side:

1. Which server?

2. Server-side JavaScript is not the best choice for doing this.
There are better languages/APIs to accomplish this, e.g. PHP('s).
If so, is it possible to parse/edit page1.htm and page2.htm before
writing them out.


Yes, it is, and it could be necessary for not creating invalid HTML.
Once retrieved the content of the two other files, you can perform
any String operation you like on it before including it in the first
document.
PointedEars
Jul 20 '05 #3

P: n/a
In article <40************@PointedEars.de>, Thomas 'PointedEars' Lahn
<Po*********@web.de> writes:
If so, is it possible to parse/edit page1.htm and page2.htm before
writing them out.


Yes, it is, and it could be necessary for not creating invalid HTML.
Once retrieved the content of the two other files, you can perform
any String operation you like on it before including it in the first
document.


And how would you suggest doing that without an IFrame or Layers? And, make it
cross-browser compatible (read: Opera).
--
Randy
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.