If you have a script that creates an iframe, unobtrusively, like the following example. And it links to a specific page, like page2.html, that page loads in immediately, like it should.
But what if you want to reload the page in this external created iframe afterwards, for example when clicking on a link or another event, that the iframe loads page3.html or some other page, with a reload or redirect?. How do you do that?
Because I can’t seem to get acces to this frame or it’s behaviour if it is pushed in my html from external manners this way. If it was already in the html page, it’s easier I think but this is not the case.
Any help?
<head>
<script type="text/javascript">
window.onload = function(){
var od = document.getElementById('originalDiv');
od.innerHTML += "<iframe src='page2.html'></iframe>";
}
</script>
</head>
<body>
<div id="originalDiv"></div>
</body>
Thanks