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