Skip to content

Instantly share code, notes, and snippets.

@GaurangTandon
Created April 12, 2024 13:49
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 GaurangTandon/0a8e7353fc630def8fe65b209c198e89 to your computer and use it in GitHub Desktop.
Save GaurangTandon/0a8e7353fc630def8fe65b209c198e89 to your computer and use it in GitHub Desktop.
get the count of all iframes nested in a given window including the window itself
function getIframesCount(win) {
let count = 1; // self frame
for (let i = 0; i < win.frames.length; i++) {
count += getIframesCount(win.frames[i]);
}
return count;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment