Reloading iFrames with JavaScript
Want to refresh an iframe without compromising code aesthetics? Read on to discover a better solution than setting the src attribute to itself.
Problem:
How do I reload an iframe using JavaScript without resorting to untidy code practices?
Answer:
Leverage the contentWindow property:
document.getElementById('some_frame_id').contentWindow.location.reload();
Note: In Firefox, accessing window.frames[] by id doesn't work. Instead, use name or index.
The above is the detailed content of How to Reload an iFrame in JavaScript Without Messy Code?. For more information, please follow other related articles on the PHP Chinese website!