<!DOCTYPE HTML Frameset DTD>
window.onload = function()
var allFrames = ;
for(var i = 0; i < context.frames.length; i++)
console.log(context.frames[i].name + " -- " + context.frames[i].location.href);
console.log("Frames count: " + allFrames.length);
<frame id="frmain1" name="main1" src="frame0_1.htm">
<frame id="frmain2" name="main2" src="frame0_2.htm">
<frame id="frmain3" name="main3" src="frame0_3.htm">
Makes sense - I have run into similar situations myself when updating legacy products. Thanks for satisfying my curiosity. Let me know if you have any issues with the solution.
Thanks for your answer, thing is I'm improving some existing web app that is based on frames - i don't have access to source itself only way i can improve it is with GreaseMonkey and user defined script - so that is why I'm insisting on dealing with frames instead of iframes. And yes because of jQuery flexibility i will use it instead native JS. Thanks once again!
This writes to the console just to show you what is going on, but of course you can do whatever you want with this information. It creates a flat list (array) of all child frames, but you could structure it hierarchically if you like, or whatever.
Use a recursive function and the window load event, like so (works in latest versions of Chrome, FireFox and Edge; didn't test others. Probably works in IE5+ also).
You are using the HTML5 DOCTYPE, but frameset is not supported by HTML5. But it is up to the browser to decide when to stop supporting this, and many of them still do. I recommend you stop using frameset ASAP. Use iframe instead if you need frame-like behavior (different windows and documents).