What’s the best way to reload / refresh an iframe?
Solution 1:
document.getElementById('some_frame_id').contentWindow.location.reload();
be careful, in Firefox, window.frames[]
cannot be indexed by id, but by name or index
Solution 2:
document.getElementById('iframeid').src = document.getElementById('iframeid').src
It will reload the iframe
, even across domains!
Tested with IE7/8, Firefox and Chrome.
Solution 3:
If using jQuery, this seems to work:
$('#your_iframe').attr('src', $('#your_iframe').attr('src'));
Solution 4:
Add empty space also reload the iFrame automatically.
document.getElementById('id').src += '';