Cloning entire page to hidden frame

G

Giggle Girl

Is it possible using javascript to copy the entire contents of a frame,
at code level, to a hidden frame or even variable or container, so you
can spit it out again instantly to a frame in the future?

I am helping to develop a web application that uses three different
frames, but there is quite a bit of changing of frame sources.
Needless to say, when a frame has its location changes, the "old"
contents are lost. I want to keep them somewhere.

Then, when a user needs to "revisit" the old frame, I want to dump its
contents back to any of three other frames. This will maintain state,
and make for quick "refreshes".

Is this possible?

Ann
 
R

RobG

Giggle said:
Is it possible using javascript to copy the entire contents of a frame,
at code level, to a hidden frame or even variable or container, so you
can spit it out again instantly to a frame in the future?

Why not just set its CSS display property to hidden and have the new
frame display its place? To re-display it, set its display property to
'' (empty string).

I am helping to develop a web application that uses three different
frames, but there is quite a bit of changing of frame sources.
Needless to say, when a frame has its location changes, the "old"
contents are lost. I want to keep them somewhere.

Then, when a user needs to "revisit" the old frame, I want to dump its
contents back to any of three other frames. This will maintain state,
and make for quick "refreshes".

You can clone the entire frame, but then you run the risk of creating
multiple instances of the same element ID. Presumably you will clone
the content then delete the original - the above hide/show method
achieves that with simplicity.
 
G

Giggle Girl

Hmmm Rob,
I am thinking about what you are saying. Does it work like this:

In a specific frame, have each possible "page" contained in a div tag,
and set all of them to visibility: hidden except the one being used?
Is this right?

If not, please explain what you mean. :)

If it is right, there will be some issues, because the application I am
helping to build does a lot of serverside stuff, and currently passes
many values using a location = "_page_to_display?vals=lotsofstuff" when
a new page is to be displayed. Having to redo this method may take too
much devleopment time and possibly goes beyond my jurisdiction.

Any more thoughts on this?

Thanks so much,
Ann
 
R

RobG

Giggle said:
Hmmm Rob,
I am thinking about what you are saying. Does it work like this:

In a specific frame, have each possible "page" contained in a div tag,
and set all of them to visibility: hidden except the one being used?
Is this right?

If you use visibility:hidden, elements still take up room on the page as
if they were still visible. display:none completely removes them from
the flow. Setting display to '' (empty string) puts them back in so
they are visible and take up space again.
If not, please explain what you mean. :)

If it is right, there will be some issues, because the application I am
helping to build does a lot of serverside stuff, and currently passes
many values using a location = "_page_to_display?vals=lotsofstuff" when
a new page is to be displayed. Having to redo this method may take too
much devleopment time and possibly goes beyond my jurisdiction.

Any more thoughts on this?

What do you do with the 'lots of stuff'? Your original question was
about removing an element and its content from the page, then putting it
back later. Using the display property is one way, another is to
actually remove the element from the page.

Document fragments can be removed and stored by keeping a reference to
them or by creating a document fragment and attaching them to that - see
this thread:

<URL:
http://groups.google.co.uk/group/co...2?q=document+fragment&rnum=2#55ce856ff314f102
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,434
Messages
2,571,690
Members
48,796
Latest member
Greg L.

Latest Threads

Top