03-21-2012, 04:06 AM
Trying to use js to reload an iframe so that it can do a query again and show a live update to the given number.
<iframe id="ifrm" name="ifrm" onload="ifrm.window.location.reload();" src="url" width="400px" height="100px" scrolling="no" frameborder="0">
Sorry, your browser doesn't support iframes.
03-21-2012, 05:03 AM
No, that won't work. For starters, only MSIE lets you refer to objects by their id directly, as you are doing.
Other browsers would require document.getElementById('ifrm')
But why do either? Just use this to refer to the iframe. After all, the onload method is a method on <iframe>.
But I don't get why you want the <iframe> to be reloaded as soon as it is loaded. Wouldn't you want to wait a while, for something to change? As it is, you are virtually guaranteed that you will be reloading exactly what was just loaded.
03-21-2012, 05:07 AM
Why not simply change src= of the <iframe>? That you *can* do from the main window.
Tacking on the random querystring will force the browser to load the page instead of using a cached copy.
03-21-2012, 11:22 PM
Hi Old Pendant, you are right about the cross website security issue, there is no way to change content hosted on a different url.