How to concatenate web pages - client side only ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tur130
    New Member
    • Jul 2010
    • 16

    #1

    How to concatenate web pages - client side only ?

    I want to create a web site with multiple pages that one can think of as sections to a large document. What I also want is a web page that is simply the concatenation of the other web pages. (I want more than one actually differing only by the order in which the concatenation is done)

    I know you can do this with server based code – but it ought to be possible to do this just using a browser that can ‘see’ the separate files that need to be concatenated.

    Other’s claim this can’t be done since each page has its own styles, scripts etc. so how would the concatenated page know how to apply them. In my case I can design all of the pages to avoid conflicting styles and unless the solution requires it avoid the use of scripts.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    For the sections, you can use frames or iframes.

    For the concatenation, you will need to use JavaScript as long as the pages are from the same domain.

    Comment

    • tur130
      New Member
      • Jul 2010
      • 16

      #3
      Thanks for response. The files are from the same domain.

      Frames are not working for me since the user needs to be able to right click and print the whole concatenated document. With frames they can only print the frame where the cursor is.

      This seems such an obvious oversight of HTML - does any know if it will be easy in HTML v5?

      e.g. have say an <include> tag which simply pulls the body or named ID from another URL and inserts it in to the page being rendered.

      Any one know if one of the java script frameworks out there has a function to parse another URL looking for a given ID (say a DIV or BODY) and then pull that section to write on the page being rendered?

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        There is something called xinclude, but support is probably almost non-existent.

        You can use Ajax to include the HTML snippet (perhaps with a bit of parsing) into your page.

        There is also the possibility to convert your HTML to JavaScript statements, but I don't think that makes sense and isn't worth the effort.

        Comment

        • JKing
          Recognized Expert Top Contributor
          • Jun 2007
          • 1206

          #5
          Just curious here, but why are you choosing to not use server side scripting?

          Comment

          • tur130
            New Member
            • Jul 2010
            • 16

            #6
            Reason - I don't have any control over the web server. I can only put content up there.

            Comment

            Working...