I like to download the html code via JavaScript. This HTML-Code is an extern webpage which will be displayed in iframe. Is it possible to get HTML-Code how it is displayed in this iframe.
So here is my try:
<body>
<iframe id="iframe_htmlcode1" name="iframe_htmlcode" src="http://www.w3schools.com"></iframe>
<textarea id="TextArea1" name="S1"></textarea>
<script>
function getAndSetContent() {
var x = document.getElementById("iframe_htmlcode1");
var y = (x.contentWindow || x.contentDocument);
document.getElementById("TextArea1").value = y.documentElement.innerHTML;
}
</script>
<input id="Button1" type="button" value="button" onclick="getAndSetContent()" />
But y.documentElement.innerHTML returns nothing. I've tried it also with a local html document which will be used in the iframe, which works fine.
Any suggestions?
THANKS