admin管理员组

文章数量:1336321

Hello I have a rendered jsp that does what I want, I need to show it on the second display, how would I copy the entire dom of the current window and create a pletely new window? I will later want from the master to further edit that child window and write to it. Any insight greatly appreciated.

Hello I have a rendered jsp that does what I want, I need to show it on the second display, how would I copy the entire dom of the current window and create a pletely new window? I will later want from the master to further edit that child window and write to it. Any insight greatly appreciated.

Share Improve this question asked Feb 13, 2011 at 1:59 cp.cp. 1,2715 gold badges15 silver badges27 bronze badges 9
  • @SLaks: agreed. Anyways, I would copy the document.body.innerHTML into the new page. – JCOC611 Commented Feb 13, 2011 at 2:02
  • 1 That's a very expensive operation. Do you want the entire DOM or just the content of the Body Node – Raynos Commented Feb 13, 2011 at 2:04
  • @Raynos really? It used to be the case that (at least in IE) using "innerHTML" was much faster than discrete DOM operations. – Pointy Commented Feb 13, 2011 at 2:05
  • possible duplicate of Copy Current Webpage Into a New Window – SpliFF Commented Feb 13, 2011 at 2:07
  • 1 @Pointy With a lot of hacking and black magic is it actaully possible to clone the entire state of the page into a new window? – Raynos Commented Feb 13, 2011 at 2:12
 |  Show 4 more ments

1 Answer 1

Reset to default 2

That would be tricky. You can certainly open a new window and municate with it but you can't pass DOM objects. You would basically need to convert the generated DOM to a string, pass it across to the new window and then parse it as though it was a document.

Like this: Copy Current Webpage Into a New Window

本文标签: javascriptcopy entire DOM to new windowStack Overflow