Is there a javascript script that returns the current html of the window? I mean the content of the webinspector or Firebug html tab.
Asked
Active
Viewed 1,121 times
1
-
This extension has a "View Generated Source" option which will provide what you're asking: https://addons.mozilla.org/en-US/firefox/addon/web-developer/ – Evan Davis Apr 06 '12 at 17:50
-
1possible duplicate of [Get entire document HTML as string](http://stackoverflow.com/questions/817218/get-entire-document-html-as-string) – Matt Ball Apr 06 '12 at 17:52
2 Answers
1
Yes -- this has been discussed previously here on StackOverflow:
How to get the entire document HTML as a string?
In short,
var txt = document.documentElement.innerHTML;
alert(txt);

Community
- 1
- 1

Authman Apatira
- 3,994
- 1
- 26
- 33
-
That is the html source, I mean the results after javascripts, ajax, etc...I would have the html that describes the current visualization in the browser window, or the current DOM – caporiccirob Apr 06 '12 at 17:53
-
-
Oh, ok, but with iframes it did not work, that was my problem! Thank you! – caporiccirob Apr 06 '12 at 17:59
0
try this example, it is useful for you
<html>
<style type="text/css">
body {
margin: 3em;
}
#Wrapper {
background: #aaa;
min-width: 200px;
padding: 10px;
}
#Panel {
width: 300px;
background: green;
position:absoulte;
}
</style>
<script language="javascript" type="text/javascript">
function CallPrint(strid)
{
var prtContent = document.getElementById(strid);
var WinPrint = window.open('', '', 'left=30,top=0,width=600,height=600,toolbar=1,scrollbars=1,status=0');
var ss='<html><body>' + prtContent.innerHTML + '</html></body>';
alert(ss);
WinPrint.document.write(ss);
WinPrint.document.close();
}
</script>
<body>
<div id="Wrapper">
<div id="first">Panel</div>
<div id="second">Panel</div>
<div id="third">Panel</div>
<div id="fourth">Panel</div>
<a href="#" onClick="CallPrint('Wrapper');">Click TO View Full Html</a>
</div>
</body>
</html>

srini
- 876
- 3
- 12
- 23