• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

14. Creating Dynamic Content > 14.18. Capturing Document Content

Capturing Document Content

NN 6, IE 5

Problem

You want to grab a copy of the current HTML node tree, including any dynamic changes made to it by scripts.

Solution

The need for this feature most commonly occurs when you haven’t prepared for it—for example, as an ad hoc debugging tool. Therefore, to get an emergency copy of the page’s HTML, enter the following URL as one unbroken line into the Address/Location box of your browser:

javascript: void window.open("","","").document.write("<textarea cols=80 
rows=20>" + document.body.parentNode.innerHTML + "</textarea>")

This code produces a new window containing a single textarea element displaying all HTML inside the <html> and </html> tags of the page at that instant.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint