Skip to content

Instantly share code, notes, and snippets.

@VasylBakalets
Created October 5, 2015 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VasylBakalets/9f719f849140254b856e to your computer and use it in GitHub Desktop.
Save VasylBakalets/9f719f849140254b856e to your computer and use it in GitHub Desktop.
var isFrameLoadedRecursive = function(aParent) {
if(typeof aParent === 'undefined' || typeof aParent.document === 'undefined' || typeof aParent.document === 'unknown') {
return true;
}
var result = aParent.document.readyState == 'complete' || aParent.document.readyState == 'interactive';
if(result && typeof aParent.statusbarMap != 'undefined') {
for(var s in aParent.statusbarMap) {
result = aParent.statusbarMap[s].onComplete === null;
if(!result) {
break;
}
}
}
if(result && typeof aParent.frames != 'undefined' && aParent.frames.length > 0) {
for(var i = 0; i < aParent.frames.length; i++) {
result = isFrameLoadedRecursive(aParent.frames[i]);
if(!result) {
break;
}
}
}
return result;
}
return isFrameLoadedRecursive(top)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment