Reputation: 319
I want to retrieve content of a web page loaded in iframe- I understood (from other Q&As on Stack Overflow) that this can be done using the following code :
document.getElementById('iframeId').contentWindow.document.body.innerHTML
Please clarify the following for me :
It should be ensured that the iframe has completely loaded, before running the above command.
How do I ensure this? (In javascript or java/jsp)
Upvotes: 0
Views: 439
Reputation: 18572
If you are using jQuery, you can do something like this:
jQuery("div#iframe_holder > iframe").load(function() {
// do something when iframe is done loading
});
Upvotes: 1