2

For a browser extension, I am trying to access an element that is inside a frame, but it seems like I can't find the frame.

I tried the following

var frame = parent.frames["Interface"];

var frame = window.frames["Interface"];

Both return undefined and I basically just don't understand how (if?) I can access this element, provided the information bellow:

The "achitecture" of the document is the following:

enter image description here

I need to access an element, using its ID, within the frame "Interface" that is somewhere in the body outlined in the image.

When I print the window variable, I get the following:

enter image description here

Itération 122442
  • 2,644
  • 2
  • 27
  • 73

1 Answers1

0

Exploring the winfow object, (thank you console.log), I fanally managed to find:

window[0].frames returns directly the "Interface" frame. I can then access the element with getElementById

var frame = window[0].frames;

var element= frame.document.getElementById("element");
Itération 122442
  • 2,644
  • 2
  • 27
  • 73