JayDesu JayDesu - 5 months ago 15
HTML Question

iFrame Auto Refresh Doesn't Work on Chrome but works on IE

So I've got my iframe and code below.

It works in IE
Does not work on Chrome

I feel like I'm missing the smallest detail but I can't seem to get it working on Chrome.

<body>
<iframe id="idcw" name="cw" src="/cw.htm" scrolling="No" frameBorder="0" style="border:none; width:100%; height:1300px;"></iframe>

<script>
window.setInterval("reloadIFrame();", 10000);

function reloadIFrame() {
document.frames["cw"].location.reload();
document.getElelementById("idcw").location.reload();
}

</script>
</body>


Any help would be much appreciated.

ps I've also tried the following which didn't work

document.getElelementById('idcw').location.reload();
document.getElelementById['idcw'].location.reload();
document.getElelementById["idcw"].location.reload();
document.getElelementById("idcw").location.reload();

Answer

I solved it with the following placed at the bottom of my body tag (in case anyone needed this);

<script>

window.setInterval("reloadIFrame1();", 60000);

function reloadIFrame1() {
 document.frames["idcw"].location.reload();
}

window.setInterval("reloadIFrame2();", 60000);

function reloadIFrame2() {
 document.getElementById('idcw').src = document.getElementById('idcw').src; 
}

</script>
Comments