Is there a secure way to check the loading of frames in an HTML page?

6

Some time ago I built a tool with HTML and Javascript to help debug a family of web applications.

Basically, the tool consists of a static HTML page and a collection of scripts that load a given system into an iframe and then allow you to inspect various elements of that system without the developer having to parse the source code.

To do this, the tool must identify when the user has accessed a certain screen and then inspect the elements.

However, systems also used frames, sometimes on more than one level. My solution was to go through this "tree" of frames by adding listeners to identify when each frame was loaded.

My question is: is there an elegant solution using jQuery or javascript to identify the loading of a frame hierarchy?

    
asked by anonymous 20.12.2013 / 15:35

1 answer

3
  

My solution was to go through this "tree" of frames by adding listeners to identify when each frame was loaded.

This is the only solution, there is no magic or voodoo that checks at once whether a hierarchy of window or document objects has completely loaded.

I do not know the details of your implementation, but the solution I imagine to be most elegant is to create a generic function (or maybe create a jQuery plugin) to deal with it by using promises or by firing a event when everything is loaded. So you isolate this problem and do not mess up your logic.

    
20.12.2013 / 16:08