0

I have a page with a dynamically added iframe, the iframe body has a link in it.

How can I use jquery on the parent page, with the click() function, to click the link in the iframe that only appears after the page has loaded?

user989990
  • 155
  • 1
  • 7
  • 14

1 Answers1

0

If you are not in the same domain, then it may not be possible to due to same origin policy.

If you are in the same domain,

$('#iFrameID').contents().find('#linkID').click(); 

should work. Hopefully what that code is doing is self explainitory.

If you are not in the same domain, you can 'spoof' the HTML into your own domain. See here for.. well basically this question actually.

EDIT:

The question is actually "how do I access the iFrame once it is loaded?"

You need some sort of calling function for when the page in the iFrame loads. See here for some examples.

Community
  • 1
  • 1
StuckAtWork
  • 1,613
  • 7
  • 23
  • 37