What’s the best way to reload / refresh an iframe? What’s the best way to reload / refresh an iframe? javascript javascript

What’s the best way to reload / refresh an iframe?


document.getElementById('some_frame_id').contentWindow.location.reload();

be careful, in Firefox, window.frames[] cannot be indexed by id, but by name or index


document.getElementById('iframeid').src = document.getElementById('iframeid').src

It will reload the iframe, even across domains!Tested with IE7/8, Firefox and Chrome.


If using jQuery, this seems to work:

$('#your_iframe').attr('src', $('#your_iframe').attr('src'));