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

2
  • Can you post here the output of console.log(framesets[0]) ... that would help understand what are you working with Commented Jan 27, 2018 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 Commented Jan 27, 2018 at 20:50

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

2 Comments

Document over framesets[i] is undefined
Try out my edit please :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.