From: Jacob on
How do I refresh an iframe via JavaScript from the parent page?

/Jacob

From: marss on

Jacob wrote:
> How do I refresh an iframe via JavaScript from the parent page?
>
> /Jacob

<html>
<head>
<script type="text/javascript">

function Reload () {
var f = document.getElementById('iframe1');
f.src = f.src;
}

</script>
</head>
<body>
<iframe id="iframe1" height="200" width="300"
src="http://google.com"></iframe>
<br>
<input type="button" value="Reload" onclick="Reload();">
</body>
</html>

From: Jacob on
Is there no way to use location.refresh or location.reload?

/Jacob

From: marss on

Jacob wrote:
> Is there no way to use location.refresh or location.reload?
>
> /Jacob

var f = document.getElementById('iframe1');
f.contentWindow.location.reload(true);

Value of parameter in the brackets :

false - Default. Reloads the page from the browser cache.
true - Reloads the page from the server.

But I don't know whether it works elsewere besides IE.

From: Thomas 'PointedEars' Lahn on
Jacob wrote:

> How do I refresh an iframe via JavaScript from the parent page?

window.frames[...].reload(...);

Might not be pretty, is completely proprietary, but it works always.
Even with different second-level domains.


PointedEars