0

I have code for get all frames on page:

var framesets = document.getElementsByTagName('frameset');
for (var i = 0; i < framesets.length; i++) {
  console.log(framesets[i])
}

I want get links from frame. Over document I can execute document..getElementsByTagName('a'), but how to use over frame?

framesets[i].getElementsByTagName('a') not working.

Thank you for any help

Mike Torrettinni
  • 1,816
  • 2
  • 17
  • 47
nope123
  • 349
  • 2
  • 6
  • 13
  • Can you post here the output of `console.log(framesets[0])` ... that would help understand what are you working with – rossijonas Jan 27 '18 at 20:47
  • If the frame is not pointed to a location on the same origin as your page you won't be able to access its contents as it is considered a security hazard if it was allowed – Patrick Evans Jan 27 '18 at 20:50

1 Answers1

2

Use window.frames[i].document.getElementsByTagName('a');

Tamir Kfir
  • 358
  • 2
  • 7