Не знаю. Так вроде тоже работает.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<iframe id="someId" class="someClass">
#document
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
</body>
</html>
</iframe>
<button type="submit" onclick="someFunct();">Клик</button>
<script type="text/javascript">
function someFunct() {
var someVariable = document.getElementsByTagName('iframe')[0].innerHTML;
someVariable2 = someVariable.replace(/</g, '<').replace(/>/g, '>');
document.getElementById("someArea").value = someVariable2;
}
</script>
<textarea name="" id="someArea" style="position: absolute;" cols="30" rows="10"></textarea>
</body>
</html>