window. location. reload(true); With firefox this works fine, it only refreshes the current page within the iframe.
You can use the location. reload() JavaScript method to reload the current URL. This method functions similarly to the browser's Refresh button. The reload() method is the main method responsible for page reloading.
On this page, two iframes interact with each other using JavaScript. First we show how one iframe can get references to the other iframe and the document inside it. Then we provide an example which demonstrates one iframe accessing and modifying the other's properties, objects, and content.
To clear the content of an iframe with JavaScript, we call write to write an empty string. const iframe = document. getElementById("myiframe"); const html = ""; iframe.
var iframe = document.getElementById('youriframe');
iframe.src = iframe.src;
This should help:
document.getElementById('FrameID').contentWindow.location.reload(true);
EDIT: Fixed the object name as per @Joro's comment.
provided the iframe is loaded from the same domain, you can do this, which makes a little more sense:
iframe.contentWindow.location.reload();
Works for IE, Mozzila, Chrome
document.getElementById('YOUR IFRAME').contentDocument.location.reload(true);
You can use this simple method
function reloadFrame(iFrame) {
iFrame.parentNode.replaceChild(iFrame.cloneNode(), iFrame);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With