user13215374
user13215374

Reputation:

Get the tag "a" from iframe

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?

Upvotes: 0

Views: 64

Answers (1)

Zeeshan Shaheen
Zeeshan Shaheen

Reputation: 53

Try this

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

Upvotes: 0

Related Questions