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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Chao

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

    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
  • HikksNotAtHome

    #2
    Re: embedding other pages (same domain) in a new page?

    In article <3FF2319F.9D67B C1B@mail.com>, Paul Chao <barry_c@mail.c om> writes:
    [color=blue]
    >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.[/color]

    Yes [1].
    [color=blue]
    >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[/color]

    Yes [1].

    [color=blue]
    >If so, is it possible to parse/edit page1.htm and page2.htm before
    >writing
    >them out.[/color]

    Yes[1].

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

    --
    Randy

    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: embedding other pages (same domain) in a new page?

      Paul Chao wrote:
      [color=blue]
      > 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.[/color]

      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).
      [color=blue]
      > If so, is it possible to parse/edit page1.htm and page2.htm before
      > writing them out.[/color]

      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

      Comment

      • HikksNotAtHome

        #4
        Re: embedding other pages (same domain) in a new page?

        In article <4000D600.10906 @PointedEars.de >, Thomas 'PointedEars' Lahn
        <PointedEars@we b.de> writes:
        [color=blue][color=green]
        >> If so, is it possible to parse/edit page1.htm and page2.htm before
        >> writing them out.[/color]
        >
        >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.[/color]

        And how would you suggest doing that without an IFrame or Layers? And, make it
        cross-browser compatible (read: Opera).


        --
        Randy

        Comment

        Working...