geds13
geds13

Reputation: 191

Targeting an iFrame inside another page

how do i target an iframe in another page from my current iframe?

For example.

Page1 -> iFrame (I click a link that would go to the iframe in page2)

Page2 -> iFrame (view the output made by the link in the iframe in page 1

Upvotes: 1

Views: 114

Answers (1)

André Pavan
André Pavan

Reputation: 101

The window has a frames array, you need to access it.

You need to run window.top.frames[1].src = 'http://...';.

window.top means that you will run this code from the main window.

EDIT: Assuming that the link is clicked from frame 0 and opened in frame 1.

Upvotes: 1

Related Questions