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
How to refresh an IFrame using Javascript?
var iframe = document.getElementById('youriframe');
iframe.src = iframe.src;
Reload iframe using javascript
function reload( {
document.getElementById('iFrameID').contentDocument.location.reload(true);
}
Refresh page within an iframe
As stated in http://www.hyperorg.com/blogger/2007/03/24/refresh-an-iframe-in-ie-anyone/
HTML
<div id="wrapper"></div>
Javascript
function reload () {
var fr=document.getElementById('tehframe');
if(fr!=null) document.getElementById("wrapper").removeChild(fr);
var iframehtml="<iframe id='tehframe' src=…></iframe>";
document.getElementById("wrapper").innerHTML=iframehtml;
}
Then just call reload()
at the beginning and whenever you want to load it.
Related Topics
How to Detect Browser Back Button Click Event Using Angular
How to Display a Success Message After Redirecting the User Back to My Home Page
How to Append Value to an Array Only If Not Exists and Remove It If Not
Opening Pdf String in New Window With JavaScript
React Wait Until Set State in the Same Function
How to Access External Json File Objects in Vue.Js App
How to Clear the Focus in JavaScript
Handling Multiple Http Responses One by One in Angular 6
Foreach Is Not a Function Error With JavaScript Array
How to Specify Multiple Conditions in an If Statement in JavaScript
Print Pdf Directly from JavaScript
How to Check If a Textbox Is Empty Using JavaScript
How to Change Color of Ag-Grid Cells for Dynamically Changing Data