Created
April 12, 2024 13:49
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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