0

This is my code, i need to get the tag "a" from the iframe but when i get it i get an empty array like this: Empty array

const frame = this.pdfViewer.iframe.nativeElement
    const frameArray = frame.contentWindow.document.getElementsByClassName("page")[this.pdfViewer.page - 1].getElementsByTagName("a")
    console.log(frameArray)

but when i open it i have this: This is the "a" on my array. How can i get the tags?

  • Does this answer your question? [Invoking JavaScript code in an iframe from the parent page](https://stackoverflow.com/questions/251420/invoking-javascript-code-in-an-iframe-from-the-parent-page) – evolutionxbox May 26 '21 at 09:52
  • Mmmm i don't thinks so, i think that my problem is that the html is loaded after the JS, or am i missing somehting? –  May 26 '21 at 10:01

1 Answers1

0

Try this

const frame = this.pdfViewer.iframe.nativeElement const frameArray = frame.contentWindow.document.getElementsByClassName("page")[this.pdfViewer.page - 1] console.log(frameArray.getElementsByTagName("a"))