I would like to reload an <iframe>
using JavaScript. The best way I found until now was set the iframe’s src
attribute to itself, but this isn’t very clean. Any ideas?
To check if iframe is loaded or it has a content with JavaScript, we can set the iframe's onload property to a function that runs when the iframe is loaded. document. querySelector("iframe"). onload = () => { console.
Speaking of frames, sometimes you want to reload the upper or lower frame of PCRecruiter. Using the browser's main refresh icon or the F5 keyboard shortcut will reload the whole window and log you out. Instead, right-click inside of the panel you want to reload, and choose Reload Frame from the context menu.
The location reload() method in HTML DOM is used to reload the current document. This method refreshes the current documents. It is similar to the refresh button in the browser. Parameters: This method contains single parameter forceGet which is optional.
The HTML <object> element represents an external resource, which can be treated as an image, a nested browsing context, or a resource to be handled by a plugin. But keeping your Iframe idea, You could also load your HTML inside your iframe tag and set it as the srcdoc value.
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 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