Is there a way to show html source in the browser after insertion by js via ~.innerHTML = Source;
?
views:
54answers:
4
+4
A:
If you're working with Firebug/Firefox or with IE8, the DOM viewer can show you the "live" DOM. It's not really "source", but I'm pretty sure that's what you're asking about.
(I didn't mention Safari or Chrome because I don't do much development with those, but they probably have similar facilities. I'm just not personally familiar.)
Pointy
2010-05-27 19:52:00
Drive-by downvotes are so pleasant.
Pointy
2010-05-27 19:59:57
Safari and Chrome has a built-in HTML/JS/DOM degubber like IE8, so we could say that it's implemenetd in every major navigator :)
Adirael
2010-05-28 08:35:51
A:
This will show the html sourcecode:
alert('<html>'+document.head.outerHTML+document.body.outerHTML+'</html>');
If you want a pretty way to see it, download a highlighting library.
M28
2010-05-27 19:57:07
Might be a little unwieldy. At least the DOM viewer/inspector highlights the code and provides a UI for live modifications for debugging/testing.
Pointy
2010-05-27 20:02:59
I thought he wanted the html source code, just implement a library to display the html and you're done :B
M28
2010-05-27 20:05:17
this is non-standard and IE-only. see here for a cross browser fix: http://snipplr.com/view/5460/outerhtml-in-firefox/ [EDIT] and here: http://stackoverflow.com/questions/1700870/how-do-i-do-outerhtml-in-firefox
seanizer
2010-05-27 20:10:46
A:
The WebDeveloper add-on for Firefox among its many useful features also has a 'View Generated Source' feature that works just like view source, but includes the dynamic content. Simple and quick.
Matthew Smith
2010-05-27 22:09:02