0

I was able to grab a link from my iframe from the parent. They are on the same domain.

var iframe = document.getElementById('ifr1');
doc = iframe.contentDocument;
doc.getElementsByTagName('a')[10].href

How can I click on that link from the parent?

Patrick Desjardins
  • 136,852
  • 88
  • 292
  • 341
user3893623
  • 311
  • 1
  • 5
  • 14

2 Answers2

0

In JavaScript:

doc.getElementsByTagName('a')[10].click();

Or

window.location.href = doc.getElementsByTagName('a')[10];

Or you can invoke any links with JQuery this way:

$("#ifr1 a:eq(10)").click();
Patrick Desjardins
  • 136,852
  • 88
  • 292
  • 341
-1

I don't know if its possible, but I would read the href and set it as the location.path

Hendrik
  • 131
  • 1
  • 10