and
I'm not sure if you can test for malformed HTML or missing elements without knowing exactly what to expect and testing for it specifically.
If you have access to the source of the iframe page you could call a javascript function variable before the end of the </body>
bound to the parent window; (or use the window.onLoad() event to call trigger the call.)
Define this method in your container page.
window.iAmLoaded = function() {
alert('iframe loaded OK');
};
Then call it from the iframe;
<script type="text/javascript" charset="utf-8">
window.parent.iAmLoaded();
</script>
</body>
If this is not an option, and the iframe has a fairly well known DOM, or a distinctive element near the end of the page, you can use getElementById or your favourite library's CSS selector method to locate the element.
You can use the onLoad event for the iframe to tell when its completed loading. http://www.w3schools.com/jsref/jsref_onload.asp
For detecting malformed html: You're looking for a validator. Browsers don't do that, except, maybe, for xhtml strict. There could well be js validation software.
Larry
Post a Comment for "Detect If IFRAME's Document Is Malformed"