rivers
rivers

Reputation: 465

How can I copy dynamically generated source HTML from the web?

For design purposes, I want to copy the exact HTML that is created by some JavaScript after the page loads. Firebug shows me what's going on, of course, but I really just want some static text that I can copy and paste at will.

Upvotes: 4

Views: 7690

Answers (6)

vivek.m
vivek.m

Reputation: 3331

For IE/firefox, following bookmarklet works: https://www.squarefree.com/bookmarklets/webdevel.html#generated_source

For google chrome, right click on any element and choose 'Inspect Element' option. It will show the position of element in DOM. Now right click on '

For opera, right click on any element and choose 'Inspect element'. This will start opera dragonfly. In dragonfly window, Click on 'Expand the DOM tree' button (first button with a dot and two arrows) and then 'export the current DOM panel' button (second button)

In IE, open the webpage and press F12 to open developer tools. Click View->Source->DOM(page) or shortcut Ctrl+Shift+G in developer tools window. This will show the complete currently visible DOM.

For firefox, alternative is Web developer toolbar extension and choose View Source->View Generated source in it.

Upvotes: 0

JasonPlutext
JasonPlutext

Reputation: 15878

In Google Chrome, choose Inspect Element, then you can right click and "Copy as HTML"

Upvotes: 3

fenec
fenec

Reputation: 5806

you could also write a perl script with the Library mechanize.

Upvotes: -1

lance
lance

Reputation: 16342

The "View Source" menu of the Web Developer Firefox Add-on offers the "View Generated Source" tool.

Upvotes: 10

Dan Davies Brackett
Dan Davies Brackett

Reputation: 10071

You can copy the HTML out of firebug (or the IE8 developer toolset) into your favourite text editor.

Upvotes: 4

Gumbo
Gumbo

Reputation: 655499

That can be done with the innerHTML or outerHTML properties. Or just in Firefox, select the part you want the source code from and select View Selection Source from the context menu.

Upvotes: 6

Related Questions