I have two frames of which I copy the content of the first (myframe) to the second (myframe2) using JavaScript and set myframe2's src:
<iframe id="myframe" src="../Page1.aspx" width="100%" height="100px"></iframe>
<iframe id="myframe2" width="100%" height="100px"></iframe>
<button onclick="myFunction();return false;">Try it</button>
<script>
function myFunction() {
var iframe1 = document.getElementById("myframe");
var iframe2 = document.getElementById("myframe2");
iframe2.contentWindow.document.body.parentElement.innerHTML = iframe1.contentWindow.document.body.parentElement.innerHTML;
iframe2.setAttribute("src", iframe1.src);
}
</script>
FrameSecond reloads after "src" attribute is set, but I don't need it to do so. Can anyone help me with this?