I need a java script function that converts the document object of the current loaded page back to source. In firefox, this is smth like this:
var doc = document;
var str = (new XMLSerializer()).serializeToString(doc);
alert(str);
But I need a cross browser solution. How to do it?
For example:
<html>
<body>
<script>
alert( asText(document) );
</script>
</body>
</html>
:
<html>
<body>
<script>
alert( asText(document) );
</script>
</html>
how would you implement the asText function?
Chris source
share